Recently I got introduced to a great tool called Vagrant. I like this tool because it is helping my life as a developer. My new project is using Ruby on Rails. I liked the simplicity of Ruby but all these gems that it installs in some internal directory got me thinking that it should be done on a separate virtual machine so that I can reclaim the space whenever I need it. Vagrant helped me in achieving that.

So here it goes: You need to install 2 softwares first:

  1. VirtualBox
  2. Vagrant

After that you need to create a folder where you want to work on Ruby on Rails projects. In our example it will be

mkdir /Users/sachin/Development/RubyTraining

Next step is to create a Vagrantfile. Here are the contents of my Vagrantfile

# -- mode: ruby --
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| = "precise64"
  config.vm.provision :shell, :path => ""  
  config.vm.box_url = "" :private_network, ip: ""

As you see I’m using to provision my virtual machine. Here are the contents of my

sudo apt-get update
sudo apt-get -y  install curl
\curl -sSL | bash -s stable --ruby
source /usr/local/rvm/scripts/rvm
gem install rails -V
sudo apt-get -y install nodejs

After this you only need to run one command and then sit back and enjoy watching your machine get ready for Ruby on Rails projects

vagrant up

Now you can ssh on that machine and run your Rails applications from your virtual machine.