Software installation instructions for CS54
You'll be using two things in this course, SML and a text editor for editing your code.
- If you're planning on working in the CS labs in Edmunds: These things are already installed for you! The only things you'll need to setup is syntax highlighting (see the instructions below for Sublime text).
- If you're planning on working on your own computer: You'll need to install both of these things. Follow the instructions below.
Installing SML
Mac OS
- Install Homebrew. (If you're not sure if you have it installed already, open Terminal and type ``brew'').
- Install SML by typing the following two commands into Terminal
brew cask install smlnj
brew cask upgrade smlnj
- Install rlrwap
brew install rlwrap
- 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".
- If it says "bash", in the Terminal type:
echo 'export PATH="$PATH:/usr/local/smlnj/bin"' >> ~/.bash_profile
echo 'alias sml='rlwrap sml'
- If it says "zsh", in the Terminal type:
echo 'export PATH="$PATH:/usr/local/smlnj/bin"' >> ~/.zprofile
echo 'alias sml='rlwrap sml'
- Start a new terminal window and you should be able to run sml
to start SML.
Windows
- 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).
- 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").
- In the cygwin terminal, run
echo 'export PATH=$PATH:/cygdrive/c/SMLNJ/bin'>> ~/.bash_profile
- Then run
echo 'alias sml="rlwrap sml.bat"' >> ~/.bash_profile
- Start a new cygwin terminal and you should be able to run sml
to start SML.
- *** 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:
- 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.
- To get syntax highlighting, install the "SML (Standard ML)"
package:
- Press on Tools > Command Palette in the menu bar and
search for “install package”, then press enter.
- Search for "SML (Standard ML)" and press enter to install.
- To use SML highlighting, you may now navigate to View >
Syntax > SML.