Vagrant setup for The Ruby on Rails Tutorial

May - 2015

TODO: Figure out timing. TODO: Put in note about how you don't have to do 'bundle install --without production' and can just do 'bundle install'

The second edition of Michael Hartl's The Ruby on Rails Tutorial1 was my Rails inauguration. It was an excellent way to get grounded in the framework2 and got bonus points for demonstrating solid development best practices (e.g. version control via Git and Test Driven Development).

Last October, the third edition came out. It has a few enhancements that caught my eye:

  • Built on the latest major version of Rails (4.2)
  • MiniTest instead of RSpec for testing
  • Updated login/auth section
  • Account email/activation examples
  • Cloud storage examples

More than enough to make it worth going through the new edition.

My first step, as a Vagrant3 user, was to make a Vagrantfile4 to create and configure a virtual machine for the tutorial5. Writing it was a lot tricker than expected. I'm posting it here in hopes it keeps others from having to go through the bug hunting calisthenics I did.

TKTKTKT - Insert final version of the Vagrantfile when everything is edited.

A simple vagrant up on that file on a recent Mac running Vagrant 1.7.2 will build and fire up a 64-bit Ubuntu 14.04 LTS box with everything needed to run through the tutorial including Rails 4.2.0 running on Rails 2.2.1 via RVM6. It even does the network mapping so that a Rails server process running on the default 3000 port in the Vagrant box shows up at http://localhost:8080/ on your machine.

Anyone interested in knowing more about what all the various calls are for can check out this follow up.

Or, just run the file and enjoy working through the tutorial without the headache of setting up a local environment.


  1. The Ruby on Rails Tutorial by Michael Hartl - There are a few ways to do the tutorial. The cheapest is to go through it for free online. It's great, but I recommend paying for the book and the videos. It was totally worth it for me to be able to hear Michael walks through everything.

  2. The Tutorial is great if you've got a little coding experience under your belt. If you're a complete beginner, bookmark it to come back to after you've gotten your feet a little wet somewhere else. (I'm still looking for the a "Start Here" recommendation I feel comfortable with for complete beginners. I'll post about it when I find it.)

  3. Vagrant is an excellent, open-source way to manage Virtual Machines. (For those unfamiliar, using a Virtual Machine is like having a second, full-blown computer running inside your actual computer. Something that's awesome when, for example, you need to work on a Linux machine but happen to be running Windows.) I repeatedly find myself wishing I'd had Vagrant when I was getting started. It makes so many fiddly, not-relevant-to-what-your-actually-trying-to-do problems simply disappear. I'm so happy that beginners today have access to it. (Not to mention pros who get even more benefit out of it.)

  4. A Vagrantfile is simply the configuration file that tells the Vagrant software how to build the virtual machine.

  5. I skimmed the tutorial for anything that should be included in the Vagrantfile. I got everything obvious. I'll add anything I missed as I actually make my run through the tutorial.