How to Install the Scala Version Manager on Your Mac

4333070249_384da2502d_z

Scala 2.11.0 is released today and I already updated.

I’m using svm (Scala Version Manager) that can be dropped from the github anyone. This tool is built by  Japanese programmer @yuroyoro.

 

Install coreutils

The svm needs coreutils that is the basic file, shell and text manipulation utilities of the GNU operating system. Do this command if you don’t install it yet.

brew install coreutils --default-names

 

Install svm, and Scala

Download svm written by @yuroyoro from github, and copy to /usr/local/bin .

Change the permission to 755.

chmod 755 /usr/local/bin/svm

Add this lines to .profile.

export SCALA_HOME=~/.svm/current/rt
export PATH=$SCALA_HOME/bin:$PATH

Are you ready? Do an action to install.

svm install 2.10.4

 

Update Scala to 2.11

svm install 2.11

After the install the 2.11, the svm says: Do you want to change current runtime version to 2.11?
Of course, you’ll say: y (yes)

 

Switch back to 2.10.4 if you want

This is a usage of the svm, you can switch back to 2.10.4 easily with svm command.

Usage :
svm [Action] [Scala-Version] [Options]

Action :
-h|help – show this usage information
-c|current – show the currently use scala version
-l|list – show the scala version installed in svm_path(default is /Users/masanori/.svm)
-v|versions – show the abalabe scala version not installed
-i|install – install specific scala version
-r|remove|uninstall – uninstall specific scala version and remove their sources
-s|switch|-u|use – setup to use a specific scala version
update-latest – install or update nightly build scala version
latest – setup to use nightly build scala version
stable – setup to use stable(x.x.x.final) scala version
(any strings) – setup to use specific scala version(shortcut of svm switch)

Options :
–docs – with install, update-latest. to download scala-devel-docs.
–sources – with install, update-latest. to download scala-sources.

Do the svm command with the switch action.

masanori:~ masanori$ svm switch 2.10.4
currently version is 2.10.4

Good.

 

(Featured Image by Paul Cross)