This recipe demonstrates how to run Singularity on your Mac via Vagrant and Ubuntu. The recipe requires access to brew which is a package installation subsystem for OS X. This recipe may take anywhere from 5-20 minutes to complete.


First, install brew if you do not have it already.

/usr/bin/ruby -e "$(curl -fsSL"

Next, install Vagrant and the necessary bits.

brew cask install virtualbox
brew cask install vagrant
brew cask install vagrant-manager

Option 1: Singularityware Vagrant Box

We are maintaining a set of Vagrant Boxes via Atlas, one of Hashicorp many tools that likely you’ve used and haven’t known it. The Singularity Box is for version 2.2.99, and will be updated appropriately with the release of 2.3. To use this box, you can simply create a folder, and then do the following:

mkdir singularity-vm
cd singularity-vm
vagrant init singularityware/singularity-2.2.99
vagrant ssh

Option 2: Vagrant Box from Scratch

If you want to use a different version of Singularity, or want to get more familiar with how Vagrant and VirtualBox work, you can build your own Vagrant Box from scratch. In this case, we will use the Vagrantfile for bento/ubuntu-16.04, however you could also try any of the other bento boxes that are equally delicious. As before, you should first make a separate directory for your Vagrantfile, and then init a base image.

mkdir singularity-vm
cd singularity-vm
vagrant init bento/ubuntu-16.04

Next, build and start the vagrant hosted VM, and you will install Singularity by sending the entire install script as a command (with the -c argument). You could just as easily shell into the box first with vagrant ssh, and then run these commands on your own. To each bento, his own.

vagrant up --provider virtualbox

# Run the necessary commands within the VM to install Singularity
vagrant ssh -c /bin/sh <<EOF
    sudo apt-get update
    sudo apt-get -y install build-essential curl git sudo man vim autoconf libtool
    git clone
    cd singularity
    ./configure --prefix=/usr/local
    sudo make install

At this point, Singularity is installed in your Vagrant Ubuntu VM! Now you can use Singularity as you would normally by logging into the VM directly

vagrant ssh

Remember that the VM is running in the background because we started it via the command vagrant up. You can shut the VM down using the command vagrant halt when you no longer need it.

Edit me