Installing SML/NJ under Windows

We provide a Microsoft Installer package for SML/NJ: smlnj-110.94.msi. The installer contains a full installation including nearly all optional components except for "mlrisc-tools" and "nowhere".

You can choose the installation directory. The default is C:\Program Files\SMLNJ. The bin directory containing the sml command is added to the default PATH, though note that you will need to re-open a command window to see the binding. The SMLNJ_HOME environment variable is also set to point at the location where SML/NJ was installed.

You can either launch the interactive top-level directly from the Start Menu entry or by opening a command prompt and typing "sml".

Note: The instructions below for building from sources on Windows using Visual Studio are no longer current. Current, tested instructions can be found at Follow steps 1 through 14 in the section "Building a Windows installer (MSI)".
To compile from sources, we assume Microsoft Visual Studio or at least the Visual C++ Express Edition and the Platform SDK:

Installing SML/NJ under Windows using Cygwin

Note: The instructions below are incomplete and do not currently work for Release 110.94. Stay tuned for updated instructions for building under 32-bit Cygwin. [DBM, 2019.11.4]
In releases before 110.77, the default behavior of config/ on Cygwin was to build and use the Win32 runtime system. As of 110.77, the default behavior is to build and use the Cygwin (i.e., Unix) version of the runtime. For the old behavior, one should set the environment variable SMLNJ_WINDOWS_RUNTIME:

Pre-110.77 instructions

  1. Choose a directory to install SML/NJ. Note that currently SML/NJ *must* be installed in a directory mounted in binmode. Installation will fail if you try to install it in a directory mounted in textmode. See the manpage for 'mount' for details.
  2. Set SMLNJ_CYGWIN_RUNTIME=1 and export the environment variable. E.g.,
           export SMLNJ_CYGWIN_RUNTIME
    in Bourne sh and variants. Or
           setenv SMLNJ_CYGWIN_RUNTIME 1
    in csh and variants. When this is set SML/NJ will select the Cygwin runtime instead of the default Windows runtime.
  3. Simply treat Cygwin as a Unix, and follow the usual installation instructions.