In this first chapter of our series, we are going to download and install the latest and compatible version of Scala programming language in Mac OS X. This tutorial was initially build using Mac OS X Leopard in 2010. It has been updated to Mac OS X Lion in 2013. It maintain all the tips which were relevant at that time, updating what are changes made and lesson learned these last three years.
0) Check Java Language:
Although Java JRE was installed by default in all the Mac OS X Leopard and it also might come with the new version, the version installed is a little bit updated, so it is recommended that we update the version in the JavaSoft guide.
The best way to check the version installed in our macs is to open a Terminal Session and enter the following commands:
macbook-pro-2:~ activoricordi$ <strong>java -version</strong> Java(TM) SE Runtime Environment (build 1.6.0_51-b11-457-11M4509) Java HotSpot(TM) 64-Bit Server VM (build 20.51-b01-457, mixed mode) macbook-pro-2:~ activoricordi$ <strong>javac -version</strong> javac 1.6.0_51 macbook-pro-2:~ activoricordi$
1) Download the Scala Language:
In this tutorial, we do not cover how to install Scala with a Package Manager such as Brew or MacPorts. Both Homebrew and MacPorts will install Scala in /usr/local, install the docs and the tools as we are also doing, Therefore It is a question of preference and opinionated decision.
We download the Scala language file from the scala-lang site.
We are going to install it following the instructions given by the following sites:
I have done a quick summary of the great tips if we decide to install it manually:
- We go the official Scala Web Site, http://www.scala-lang.org/downloads. In this page, we download the installer for your environment and follow the instructions on the downloads page.
- I download the
scala-2.10.0.final.tgz, Scala 2.10.0 I extract it in the Downloads folder.
- Rename this folder scala- into “scala” to make it easier, then copy it into /usr/share.
Another possible option is using an Shell Script to download and automatically install and configure it.
curl http://www.scala-lang.org/files/archive/scala-2.10.0.tgz -o scala.tgz curl http://www.scala-lang.org/files/archive/scala-docs-2.10.0.txz -o scala-docs.txz curl http://www.scala-lang.org/files/archive/scala-tool-support-2.10.0.tgz -o scala-tool-support.tgz