Getting a Scala interpreter to work

For OS X, I highly recommend Homebrew.

The installation of Homebrew is incredibly easy. Once installed, you just need to run brew install scala and scala will be installed and ready to go. Homebrew also has tons of other goodies just a brew install away.

If you don't already have Java installed, you can install that with brew cask install java.

MacPorts or Fink may have something similar, but I prefer Homebrew.


Not a big fan of cluttering up my PATH variable. I just symlink all my programs to /usr/local/bin, which is in the classpath. For example, if you downloaded scala and uncompress it in /opt/scala-2.9.0-1, run the following in the terminal.

ln -s /opt/scala-2.9.0-1/bin/scala /usr/local/bin

Now just type scala in the terminal and you're all set. This way you don't have to set your PATH or change it when you have a new version of scala you want to try out. If you download a new version, you can uncompress it in any location and symlink the new version. Say you download version 2.9.1 and uncompress it in /opt/scala-2.9.1. You can type the following in the terminal

ln -s /opt/scala-2.9.1/bin/scala /usr/local/bin/scala2.9.1

Now, to use scala 2.9.1 you just run scala2.9.1 at the terminal. When you are ready to switch to 2.9.1 fulltime, just update the symlink.

You could also add scaladoc, scalac, scalap and others in the same way

ln -s /opt/scala-2.9.0-1/bin/scalac /usr/local/bin
ln -s /opt/scala-2.9.0-1/bin/scalap /usr/local/bin
ln -s /opt/scala-2.9.0-1/bin/scaladoc /usr/local/bin
ln -s /opt/scala-2.9.0-1/bin/fsc /usr/local/bin
ln -s /opt/scala-2.9.0-1/bin/sbaz /usr/local/bin
ln -s /opt/scala-2.9.0-1/bin/sbaz-setup /usr/local/bin

Scala recommends using Homebrew to install the Typesafe stack for Scala 2.9.2.

brew install scala sbt maven giter8

Homebrew will install soft links in /usr/local/bin for sbt, scala, scalac, scaladoc, scalap, fsc and g8. Follow the soft links to its final referent in order to determine where $SCALA_HOME needs to be. $SCALA_HOME should contain bin/scala and lib/scala-compiler.jar.

Typesafe recommends using sbt console instead of scala to get the interpreter going, because sbt will also manage library dependencies to libraries such as Akka. That said, if you want to use scala, scalac, fsc, scalac and scaladoc directly, you may need to run a chmod +x on the referents of the soft links.


You need to add scala\bin to your PATH environment variable.

On Mac OS X the path to Scala bin is usually: /Users/<your username>/scala/bin and on Windows usually: C:\Program Files (x86)\scala\bin.

On Mac OS X use the Terminal and write (using your username):

echo 'export PATH=/Users/<your username>/scala/bin:$PATH' >> ~/.bash_profile

then close the Terminal and start it again.