The world is my backyard.
Random header image... Refresh for more!

Installing Scala on Snow Leopard

These are instructions for quickly installing Scala. Scala is a general purpose language almost completely interoperable with Java, and having features of object-oriented and functional languages.

I installed Scala in /usr/local , the reason for which can be found here.

Prerequisite

Before starting installation, you will need **:

  1. Mac OS X 10.6 Snow Leopard
  2. The latest Xcode Tools (from the Snow Leopard DVD or downloaded from Apple — the 10.5 version won’t work)
  3. Confidence running UNIX commands using the Terminal

Step 1: The PATH

Launch Terminal from /Applications/Utilities folder.

First lets set the PATH variable using a text editor. I use Textmate (hence the mate command). You can use Textmate, Smultron or vim.

mate ~/.bash_profile

At the end of this file add(even if it is blank)

export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/scala/scala-2.7.5.final/bin:$PATH"

Save and close the file. Close the Terminal. On restarting the terminal, enter following command:

echo $PATH

We should be able to see /usr/local/scala/scala-2.7.5.final/bin as one of the paths. Note: If we were compiling scala, we would prefer its binaries to be at /usr/local/bin/scala. However we are taking the easier route.

Step 2: Download Scala

I keep all my software installers that I install away from Application folder, in a folder in home directory.

Make a new folder:

mkdir ~/SourceFolder
cd ~/SourceFolder

Download scala IzPack Installer:

curl -O http://www.scala-lang.org/downloads/distrib/files/scala-2.7.5.final-installer.jar

Step 3: Install

The installer needs administrator permission. Hence install by double click would not complete due to permissions issue.

On the Terminal:

sudo java -jar scala-2.7.5.final-installer.jar

Type in the password when prompted. Installer GUI would start

Scala Installer 1

Choose language.

Scala Installer 2

Goto next.

Scala Installer 3

Read and accept the license.

Scala Installer 4

By default, the installer will install in /usr/local/. However choose /usr/local/scala/, otherwise the installer tends to overwrite /usr/local.

Scala Installer 5

Scala is installer.

To verify, we’ll run Scala interpreter:

scala

On my machine, it shows:

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

scala>

Type :quit to exit from the interpreter.

Scala is installed on Snow Leopard.

* The writing style of tutorial is shamelessly inspired by Hivelogic.

0 comments

There are no comments yet...

Kick things off by filling out the form below.

Leave a Comment