Raspberry Pi and Scala: The Typesafe Stack

1 minute read

Following on from my earlier post I wanted to get the the full Typesafe Stack on my little Raspberry Pi.

So here we go:

according to the documentation on the Typesafe website you should use the “Universal install”, i.e. download a tarball and copy it to a place of your choice.

$ wget http://downloads.typesafe.com/typesafe-stack/2.0.2/typesafe-stack-2.0.2.tgz
$ tar xovzf typesafe-stack-2.0.2.tgz
$ sudo mv typesafe-stack /opt
$ chown -R bin.bin /opt/typesafe-stack

Next you need to make sure the new software is found by adding the bin directory of the typesafe stack to your PATH (and if you followed my earlier post you should also remove the separate sbt installation from your PATH)

my /etc/profile now contains this:

$ PATH=$PATH:/opt/typesafe-stack/bin
$ export PATH

then log out and log in again and check your PATH.

$ type sbt
$ type g8

these should point to the newly installed typesafe-stack directory.

You can now either run your commands with reduced memory allocation with the -mem 128 flag or you can hack the startup file:

$ diff sbt-launch-lib.bash sbt-launch-lib.bash.orig
79c79
< local mem=${1:-128}> local mem=${1:-1536}

Now we go into our project directory (e.g. $HOME/proj or whatever you choose) and do

$ g8 typesafehub/scala-sbt

this will ask for project name and a few other things and create a directory for the new project

$ cd <your new project directory>
$ sbt -mem 128 run

Now after a fair while you will see the code compile and run.

Leave a Comment