This project is the old version of Standard ML of New Jersey that continues to support older systems (e.g., 32-bit machines). We will continue to fix bugs and make minor improvements while the main development branch matures. We will also backport additions to the SML/NJ Library and other components.
The latest legacy version is 110.99.8, which was released on April 25, 2025.
-
The SML/NJ web site
-
The SML Basis Library Specification of the SML '97 Basis Library, which SML/NJ supports
-
The SML of NJ Library Documentation for the additional libraries included in SML/NJ
-
The Standard ML of New Jersey Wiki This wiki documents the implementation of SML/NJ
SML/NJ is available in several ways
-
we distribute installer packages for macOS and Windows
-
it is available from many package managers for Linux, macOS, and Windows.
-
you can build it from the distribution files using the
config/install.sh
script -
you can build it from the GitHub repository
Note that for the latest version of SML/NJ, you should build from source (as described below), since the versions available from Linux package managers are often out of date.
Package Manager | Installation Command |
---|---|
pacman -S smlnj |
|
apt install smlnj |
|
emerge --ask dev-lang/smlnj |
|
nix-shell -p smlnj |
|
apt install smlnj |
|
zypper install smlnj |
We distribute installer packages for both macOS on both 32-bit and and 64-bit Intel hardware (for an Arm version, see the development version. It is also available from Homebrew.
Package Manager | Installation Command |
---|---|
brew install --cask smlnj |
We distribute a 32-bit MSI package for Windows, but it is also available via standard package managers.
Package Manager | Installation Command |
---|---|
winget install -e --id SMLNJ.SMLNJ.Legacy |
|
choco install smlnj |
On Linux, macOS, and other Unix-like platforms, it is possible to
build the system from the distributed tar files. Let VERSION
be the version
that you want to install (e.g., 110.99.8
).
-
Start by creating an installation directory
% mkdir smlnj % cd smlnj
-
Download the
config.tgz
file for the version that you want to install using curl (or wget).% curl -O https://smlnj.org/dist/working/$VERSION/config.tgz
-
Unpack the
config.tgz
file.% tar -xzf config.tgz
-
Run the installation script
% config/install.sh -default $SIZE
where SIZE
is either 32 or 64. Note that the x86-64 (aka amd64)
is the only 64-bit architecture supported by the legacy version of SML/NJ.
The preferred way to build the system is to follow the installation instructions for your platform. If, however, you want to compile the current source from GitHub, the following steps should usually work.
-
Start with a fresh clone of the repository (let
ROOT
be the root directory of the clone.% git clone git@github.com:smlnj/legacy.git $ROOT
-
Configure and install the corresponding release in the
$ROOT
:% cd $ROOT % config/install.sh
-
Use this compiler to recompile from sources
% cd base/system % ./cmb-make ../../bin/sml % ./makeml
The "
../bin/sml
" argument is optional; if omitted, then thesml
command in the user'sPATH
will be used. Once can also specify a different path to ansml
command, when appropriate.Also note that because of a flaw in the way that CM handles conditionals in CM files, it is necessary that the ml-yacc and ml-ulex commands be available in the
PATH
. If you do not have an installation of SML/NJ available, then use the following steps:% cd base/system % PATH=$PATH:$PWD/../../bin ./cmb-make ../../bin/sml % ./makeml
-
At this point, you can test the compiled code while in the
system
directory.% ./testml
-
To finish the build process, you have to install the new compiler heap image and rebuild the libraries.
% ./installml -clean % cd ../.. % config/install.sh
You should now have a version of the system in $ROOT/bin/sml
that
corresponds to the latest version of the source on GitHub.
If you subsequently pull changes from the repository, you can rebuild
starting at Step 3.
These instructions are for Unix-like systems (including macOS). We do not
have scripts (e.g., makeml
) to support this process on Windows.