22

When I go on terminal (i installed smlnj) and i type sml it gives me the error sml: unable to determine architecture/operating system. What does this mean??? I installed sml like this at this website, but I'm not sure -- are the instructions wrong?
enter image description here

blustone
  • 315
  • 4
  • 13

6 Answers6

25

The problem with recent OS X binary installers still persist just the focus moved to 10.9 Mavericks and 10.10 Yosemite versions of OS X. Although the root cause is solved in the recent source code version.

That is why from some time now solving this issue is just about having a freshly compiled binary package. And for that you might be better of installing smlnj through homebrew. You can do it with these commands:

brew update
brew cask install smlnj

As of 2021, the command to install with cask is

brew install --cask smlnj

This will compile the package for you so you can spare the trouble of checking out the source code and doing the compilation yourself.

Just to clean up your system and avoid duplication you can remove the previous installation simply by doing the following:

sudo rm -rf /usr/local/smlnj*

For the asterisk: I had one bare smlnj folder with the 110.76 inside it and one smlnj-110.75 folder I guess I had tried to install two different versions earlier...

You might need to remove any softlinks that you created yourself that point to the older smlnj folder directly under /usr/local/ removed in the previous step.

Surya
  • 2,429
  • 1
  • 21
  • 42
feka
  • 351
  • 3
  • 5
  • I tried t brew install, only to receive the following: `/usr/local/Cellar/smlnj/110.77/SMLNJ_HOME/bin/.run/run.x86-darwin: Fatal error -- Uncaught exception SysErr with raised at config/install.sh !!! Boot code failed, no heap image (sml.x86-darwin).` It's apparently a known issue. https://github.com/Homebrew/homebrew/issues/32915 (Also, could you  maybe remind people to update their brew formulas before doing install? It's easy to forget if you're not a frequent brew user). – Shon Feb 24 '15 at 15:44
  • upvoted 10 times for specificity. too bad Idol voting rules don't apply. ;-) – vwvan Oct 08 '15 at 23:00
17

If you're using OSX 10.8 or later (uname -r gives you something starting with 12 or higher), SML/NJ pre 110.75 doesn't work too well without some extra tweaking. It's a known issue that can be fixed by adding the 10.8 choice (see the 12 line below) to the OS detection code in .arch-n-opsys:

    :
    10*) OPSYS=darwin; HEAP_OPSYS=darwin ;; # MacOS X 10.6
    11*) OPSYS=darwin; HEAP_OPSYS=darwin ;; # MacOS X 10.7
    12*) OPSYS=darwin; HEAP_OPSYS=darwin ;; # MacOS X 10.8
    13*) OPSYS=darwin; HEAP_OPSYS=darwin ;; # MacOS X 10.9 Mavericks
    14*) OPSYS=darwin; HEAP_OPSYS=darwin ;; # MacOS X 10.10 Yosemite
    15*) OPSYS=darwin; HEAP_OPSYS=darwin ;; # MacOS X 10.11 El Capitan
    16*) OPSYS=darwin; HEAP_OPSYS=darwin ;; # MacOS X 10.12 Sierra
    17*) OPSYS=darwin; HEAP_OPSYS=darwin ;; # MacOS X 10.13 High Sierra

    *)   exit 1;;
esac;;
paxdiablo
  • 854,327
  • 234
  • 1,573
  • 1,953
  • The same issues are/were present for the 3.x linux kernel :s – Jesper.Reenberg Jan 19 '13 at 08:48
  • 8
    Specifically, you need to add it to `/usr/local/smlnj/bin/.arch-n-opsys`. (Mentioning it here because the link is broken, and the issue still persists with 110.79 and 10.11 El Capitan …) – Luke Maurer Apr 22 '16 at 20:19
5

As an update to paxdiablo's answer, if you're running macOS Sierra (version 10.12) you need to input the following line to get sml running:

16*) OPSYS=darwin;  HEAP_OPSYS=darwin ;; # macOS 10.12 Sierra

So with more context it will look like this:

      11*) OPSYS=darwin;  HEAP_OPSYS=darwin ;; # MacOS X 10.7 Lion
      12*) OPSYS=darwin;  HEAP_OPSYS=darwin ;; # MacOS X 10.8 Mountain Lion
      13*) OPSYS=darwin;  HEAP_OPSYS=darwin ;; # MacOS X 10.9 Mavericks
      14*) OPSYS=darwin;  HEAP_OPSYS=darwin ;; # MacOS X 10.10 Yosemite
      15*) OPSYS=darwin;  HEAP_OPSYS=darwin ;; # MacOS X 10.11 El Capitan
      16*) OPSYS=darwin;  HEAP_OPSYS=darwin ;; # macOS 10.12 Sierra
      17*) OPSYS=darwin;  HEAP_OPSYS=darwin ;; # macOS 10.13 High Sierra
      *) exit 1;;
    esac;;

SML/NJ version 110.79 had the OS X up to El Capitan configured, but Sierra was still missing.

donjay
  • 150
  • 6
the_jov
  • 185
  • 1
  • 2
  • 8
1

Sierra 10.12.6

Install SML through Homebrew brew install smlnj

Edit your .bash_profile and add export PATH=/usr/local/Cellar/smlnj/110.81/bin:$PATH to the end of the file.

After that source ~/.bash_profile to apply the new path so your system adds the new locations and then knows where to find the file it needs when you type sml

Immutable Brick
  • 830
  • 12
  • 23
1

I was struggling with this for hours after upgrading my Macbook. Previously I was on OSX 10.8 Maverick on Macbook Air for which the distribution https://www.smlnj.org/dist/working/current/index.html#macos-installer actually worked fine.

After upgrading to a Macbook Pro running OSX 10.14 Mojave, running sml after installing and adding to PATH would give me OP's error message.

After struggling to find some solution including the one marked as accepted here, what ended up working was brew cask install smlnj.

username-yj
  • 105
  • 1
  • 4
0

I ran into this issue after I accidentally installed an older version of SML/NJ. I removed my previous install by trashing /usr/local/smlnj and reinstalled using the pre-built system of OS X for SML/NJ 110.78. The most recent download is available under Downloads here, which is what future seekers should consult, as the particulars of my solution will likely be out of date by the time they come around.

Shon
  • 3,989
  • 1
  • 22
  • 35