Gareth Rushgrove recently wrote a good blog post about why you should be using virtualisation.
(incidently, it got coverage on Hacker News and David Singleton also blogged a follow up).
Anyway…
Vagrant is a tool for building and distributing virtualized development environments.
To quote the Vagrant website:
By providing automated creation and provisioning of virtual machines using Oracle’s VirtualBox, Vagrant provides the tools to create and configure lightweight, reproducible, and portable virtual environments.
The installation instructions are simple:
$ sudo gem update --system
$ gem install vagrant
However, there were a few small gotcha’s a came across which are worth sharing.
Firstly, you need to run the vagrant install under sudo (runs it with root privileges), otherwise it complains about permissions:
$ sudo gem install vagrant
Secondly, I got the following error:
$ sudo gem install vagrant
Password:
Building native extensions. This could take a while...
ERROR: Error installing vagrant:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h
Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/json-1.5.1 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/json-1.5.1/ext/json/ext/generator/gem_make.out
It turns out this is easy to solve – all you need to do is dig out your OS X install CD, go into the optional extras and install Xcode.
It takes a while to run but once it’s complete, Vagrant installs fine.