Vagrant is a helpful command line interface to various cloud and local virtual machine providers, most notably virtualbox. This tool allows me to spin up a pre-configured recreatable development environment, from scratch in minutes.

If you’re like me and work on a variety of different projects, using perhaps different Ruby versions, different versions of PostgreSQL you will want to keep those things siloed and not try to manage multiple different versions of software on your mac.

The time to get up and running either when you get a new computer or if a new developer joins the team is greatly reduced, pull your code and run vagrant up, within minutes you are free to start developing.

Getting started

For me, learning vagrant took all of about an hour, and by the time I setup my first box, I had enough knowledge and felt comfortable using it for all of my projects.

Vagrant has 3 main commands that you will need to know:

# looks at the Vagrantfile in your current directory and starts up your vm,
# it also starts it up the first time round, pulling the base vm image
# from the interwebs and running any provisioning required
$ vagrant up

# powers down the vm
$ vagrant halt

# deletes all associated vm files to save some disk space on the macbook air :)
$ vagrant destroy

I’ve mentioned vagrant destroy, for most people that rings alarm bells, but since it only takes a few minutes to provision a fresh vm again with everything setup it is a pretty safe operation!

Vagrant cloud

Vagrant cloud launched last week and is going to be extremely important to aiding the uptake of vagrant users.

Vagrant cloud provides an easily discoverable path to finding pre-configured vagrant base boxes and if you’re starting out to learn vagrant you should probably take a look there and find a base box for your language / web server / database of choice.

I have made my Ruby 2.1 base box publicly available if that’s your cup of tea. It comes pre-configured with the most common tech stack that I build off:

  • Ubuntu 12.04
  • Ruby 2.1
  • PostgreSQL 9.3.3
  • nginx
  • node js 0.10
  • Heroku toolbelt


For me the provisioning step is definitely where the learning curve gets steeper and you have to put more time into getting familiar with a system. To start off with you can use the shell provisioner with vagrant and just write your provisioning steps in a simple procedural manner.

I’ve personally decided to use Ansible as that seemed like the easiest configuration management tool to get up and running with.

Ansible playbooks are plain yaml files, no DSLs to learn. I’m finding it great to automate my workflow even further and the playbooks can be run on any system that supports SSH. I can reuse the same provisioning tool on my local vagrant VMs and my production servers.

The next step

The next move for me is to use vagrant with another provider, perhaps aws or digital ocean and have the exact same base VM image running on production and development. For now I’m happy that I can reuse my provisioning and run ubuntu 12.04 on both environments.

If you need help with your web or mobile application I’m a partner at Dawson Andrews, we specialise in digital strategy and product thinking, building rich web apps and native mobile apps.

comments powered by Disqus