Just a sort of random thought; I think it’s interesting to see the number of efforts to build new languages on old vm’s (NLOOVM).  For example:


  • Clojure
  • Scala
  • Kotlin


  • Elixir
  • Lisp Flavor Erlang (LFE)
  • Alpaca

These new languages are getting lots of traction.  Likewise it’s an interesting (and somewhat puzzling) situation with the CLR.  Pretty much anyone working on the CLR is working on C#.  Oh there are other languages on the CLR but they have nowhere near the level of interest or penetration of either Clojure or Elixir respectively.

Provisioning a VM with Scala and SBT

So I’ve been giving a little more time and attention to both Scala and Vagrant.  Vagrant is a nice way to manage development environments via the use of VM’s and Scala, of course, is a great hybrid of OO and FP.  One of the things I’ve done is to start working on a provisioning script for Vagrant so I can always get myself a development environment with Scala without much trouble.  So here’s the steps I follow.

One time steps:

1.) Get Vagrant

2.) Get Virtual Box (or some other VM management tool).

3.) Install both of those packages on your development machine.

4.) Create a new development directory on your dev machine.

5.) Run vagrant init <boxname> <box definition> in the development directory. You can find more detail on this command here and you can find a great list of base box definitions here.

6.) Edit the vagrantfile installed in the development directory to add this line:

config.vm.provision “shell”, path:””

7.) Add the following file in the same directory as the vagrantfile.

#!/usr/bin/env bash
# Onorio Catenacci 3 January 2014

echo "Installing scala and setting it up . . . "

apt-get update > /dev/null 2>&1
apt-get install -y scala > /dev/null 2>&1

# Thanks to pardigmatic on StackOverflow for this procedure to install
# SBT via apt-get on Ubuntu
# See here:

echo "Installing SBT . . ."
wget"$debfile" > /dev/null 2>&1
dpkg -i "$debfile" > /dev/null 2>&1
apt-get update > /dev/null 2>&1
apt-get install -y sbt > /dev/null 2>&1


echo "Setting up VIM for syntax highlighting"
#Create directories for vim syntax highlighting then fetch the files from github
#Credit where credit's due, one liner is from blog posting by Bruce Snyder

mkdir -p "$basevim"/{ftdetect,indent,syntax} && for d in ftdetect indent syntax ; do wget --no-check-certificate -O "$basevim"/$d/scala.vim$d/scala.vim; done > /dev/null 2>&1

rm -f "$debfile"

8.) Start the vm via the vagrant up –provision command.  This will force the file to be run to install scala, sbt and the proper vim bindings for correct syntax highlighting of scala code.  This way everytime you initialize the vm (via the vagrant init in the development directory) scala, sbt and the proper bindings for scala syntax highlighting will be automatically installed.

9.) One more thing; you can log in to the machine with vagrant ssh.  When you do, you may want to change the amount of memory that sbt asks for in its startup.  In this particular case you should be able to run $vim /usr/bin/sbt and modify these two lines:

local mem=${1:-1536}


declare –r default_sbt_mem=1536

On my machine [edit: it’s an Ubuntu 13.10 VM] in particular I had to set this to 512 [edit: turns out 256 works even better] on both lines in order to get sbt to start successfully.  I can’t give you a particular number which is guaranteed to work—play around with this until you find the right value.