Installing SML/NJ under macOS

We provide two macOS installer packages for the 32 bit (x86) compiler and the 64 bit (amd64) compiler. These packages contain a full installation including nearly all optional components. (We only exclude "mlrisc-tools" and "nowhere".) The 64 bit package is necessary for installing on macOS Catalina (10.15) and later, and it currently considered a beta version, so bug reports are appreciated. These packages are not yet notorized by Apple, so to open them on Catalina or later, you must choose "Open" from the contextual menu for the file (i.e. right click on the package icon).

The current installer lets the user choose an installation root directory. The default is /usr/local/smlnj. The SML/NJ-specific "bin" directory containing the "sml" command and its siblings is not automatically added to the shell's search path, though.

When using the installer package (even in the case when the installation directory is not the default /usr/local/smlnj) it is NOT necessary to set any global environment variables such as SMLNJ_HOME.

Kartik Singhal has recently created a Homebrew cask based on the 64-bit macOS installer package. If you have Homebrew installed on your Mac, you can install SML/NJ using the shell command:

   $ brew cask install smlnj

When developer tools (Xcode) are present on a MacOS X machine, then it is also always possible to do a generic Unix install (see the file INSTALL.html). The runtime system makefile for Mac OS X on Intel (mk.x86-darwin) is configured to support macOS versions up through Mac OS X 10.15 (Catalina).

Versions of Xcode after 10.1, which is Apple's development environment for macOS 10.14 Mojave, do not include the libraries needed to build 32-bit executables, such as the SML/NJ runtime, although 32-bit programs will still run on Mojave.

To support building the 32-bit version on Mojave, there is a Makefile (mk.x86-darwin18) for the runtime system. which the config/ script will use when necessary. This new makefile expects that the MacOSX10.13.sdk directory from Xcode 9 has been copied into the Xcode SDKs directory


Note that updating Xcode from the AppStore will likely remove the 10.13 SDK, so you should keep a copy in a safe place.

You can determine the path to the current developer directory using the command

    % xcode-select -p