July 13, 2011

Installing Scala on Mac OS X

One of the other things I’m trying to learn on my free time is Scala, like Groovy it’s a language that runs on top of the JVM and is both a object-oriented and functional programming language. One of the biggest places I know where its being used is Foursquare

Same idea as the other postings I did for installing Groovy, Grails and jRuby.

Head to the Scala home page at http://www.scala-lang.org and click on the ‘Download Scala’ which is on the right side of the page. Download the scala- (which is the latest as of writing this posting).

If you just want to download it from the command line,

$ curl -O http://www.scala-lang.org/downloads/distrib/files/scala-

If you want to ensure the file is downloaded correctly checkout the MD5 file.

$ curl http://www.scala-lang.org/downloads/distrib/files/scala-
$ md5 scala- MD5 (scala- = 10d01410fd75019fa21a88964462a077

Now that we have the file we need to untar it, move it /usr/share and make the link to Scala for it.

$ tar -xzf scala-
$ sudo mv scala- /usr/share/
$ sudo ln -s scala- scala

Last step is to update your .profile file within your home folder. Just add this to the top:

SCALA_HOME=/usr/share/scala; export SCALA_HOME

Close all Terminals and reopen one. To test to see if everything is setup right, run this:

$ scala

Welcome to Scala version (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_24).
Type in expressions to have them evaluated.
Type :help for more information.


After all this you should be all set to start working with Scala. If the time comes and you want to upgrade, all you need to do is download, unzip and move to /usr/share folder and update the symbolic link like so:

$ cd /usr/share/
$ sudo rm scala
$ sudo ln -s scala- scala

If you have any questions or comments please post, also any suggestions on improving this are welcome.

© Anthony Scotti 2020

Powered by Hugo & Kiss.