Software installation instructions for CS54

You'll be using two things in this course, SML and a text editor for editing your code.

Installing SML

Mac OS

  1. Install Homebrew. (If you're not sure if you have it installed already, open Terminal and type ``brew'').
  2. Install SML by typing the following two commands into Terminal
    brew cask install smlnj
    brew cask upgrade smlnj
  3. Install rlrwap
    brew install rlwrap
  4. At the top of your Terminal window (the grey bar), there is a lot of information (current path, window size, etc.). Between two dashes there should be either "bash" or "zsh".
  5. Start a new terminal window and you should be able to run sml to start SML.

Windows

  1. Go to https://www.smlnj.org/dist/working/110.99.3/windows.html and use the package installer to install SML. When it asks where to install, choose C:\SMLNJ\ (the default is in Program Files, but the space in that name can confuse cygwin, so change it).
  2. Install cygwin. This is a suite that supports all of the standard command-line tools we'll use in this class. Follow the instructions in "Installing Cygwin". During installation, it will ask you which packages to install. Search for rlwrap click "Skip" once so that a version number appears ("Skip" means "do not install"; the version number means "install this version").
  3. In the cygwin terminal, run
    echo 'export PATH=$PATH:/cygdrive/c/SMLNJ/bin'>> ~/.bash_profile
          
  4. Then run
    echo 'alias sml="rlwrap sml.bat"' >> ~/.bash_profile
        
  5. Start a new cygwin terminal and you should be able to run sml to start SML.
  6. *** If this works, great!, you're done. For some people using cygwin, hasn't been working. If this happens to you, try using the "Command Prompt" application. It's the built-in shell for Windows. The interface is a bit different than cygwin (which is more linux style), but the functionality is about the same.
    The main difference for now is that you use 'dir' rather than 'ls' to see the contents of a directory. Try opening "Command Prompt" and then run SML by typing "sml".

Installing Submlime Text

We recommend Sublime Text for editing SML source files.

Sublime Text is available at http://www.sublimetext.com/download

More specifically:
  1. Download the installer for your operating system. On Windows, follow the instructions in the installer. On Mac, navigate to your downloads and open the zip file. This should generate a .app file. Drag the Sublime Text .app file into your Applications folder.
  2. To get syntax highlighting, install the "SML (Standard ML)" package:
    1. Press on Tools > Command Palette in the menu bar and search for “install package”, then press enter.
    2. Search for "SML (Standard ML)" and press enter to install.
  3. To use SML highlighting, you may now navigate to View > Syntax > SML.