sml Getting started with sml

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!


This section provides an overview of what sml is, and why a developer might want to use it.

It should also mention any large subjects within sml, and link out to the related topics. Since the Documentation for sml is new, you may need to create initial versions of those related topics.


There is a dozen implementations of Standard ML. MLton produces very optimized code, but has no REPL. SML/NJ is the most widely used, but has slightly difficult error messages for learning purposes. Moscow ML and Poly/ML are easy to get started with, but don't support the .mlb package format. That isn't essential for getting started, though.

Here are instructions for installing each of SML/NJ, Moscow ML and Poly/ML divided by operating system.

On Windows


Moscow ML:

  • Go to and click "Download Win. Installer". Run the installer.
  • You now have a REPL in e.g. C:\Program Files (x86)\mosml\bin\mosml.exe .

Using Homebrew On MacOS


  • Run brew install smlnj as your own user. Test REPL with smlnj .

Moscow ML:

  • Go to and click "Download PKG File". Run the installer.
  • Missing... Test REPL how? Is it in $PATH now?

On Ubuntu / Debian Linux


  • Run sudo apt-get install smlnj as the super user. Test REPL with smlnj .

Moscow ML:

  • (Ubuntu) Add the PPA as the super user. Test REPL with mosml .

    sudo add-apt-repository ppa:kflarsen/mosml
    sudo apt-get update
    sudo apt-get install mosml

Adding readline support

In order to be able to use the arrow keys to navigate lines that were previously typed into the REPL, most of the SML compilers can benefit from the program rlwrap . Using Homebrew on MacOS, install this by brew install rlwrap , and on Ubuntu / Debian Linux, install this by sudo apt-get install rlwrap . Then in the terminal, try the following:

alias mosml='rlwrap mosml -P full'
alias sml='rlwrap sml'
alias poly='rlwrap poly'

These aliases can be added to e.g. your ~/.bashrc so they work by default.

The arrows key should now work better.

Got any sml Question?