Getting setup with Ruby

Ruby can run on Mac, Windows, Linux, BSD and many more systems, but each one has its quirks and it's easy to waste a ton of time configuring things.

In an attempt to make things easier for this class we'll be using a virtual machine to run all the code you write. The virtual machine will let you run all the Ruby code you write within a nicely-configured Ubuntu Linux environment. It works the same on Mac or Windows.

All the computers in the lab already have this setup. These instructions are for your own computer.

(As an added benefit, you'll certainly end up logging into Linux computers as part of your future work. This will give you a chance to get familiar with the commands.)

The stuff you need first

Step 1

Download and install VirtualBox on your computer.

Step 2

Download and install Vagrant 1.6.5 on your computer.

(Vagrant 1.7 has a glitch on Windows right now, so we're using the previous


Step 3

Install Git.

Time for the actual virtual machine

Now clone the Git repository I setup with the scripts to setup the class virtual machine.

Open Terminal on your Mac, or Git Bash on Windows. Then run:

git clone

Once the repository has been cloned, change into the repository directory:

cd rails-dev-box

Now run the command to start building the virtual machine:

vagrant up --provision

The first time you do this it will take a while since it has to download the entire operating system. Afterwards it will be much faster.

Log in to your virtual machine:

vagrant ssh

When you're done, type exit in the virtual machine and then run vagrant halt if you want to shut down the virtual machine.

Day to day

Whenever you want to work in the virtual machine, open your terminal and go to the `rails-dev-box` directory.

  • Make sure the virtual machine is up to date: git pull
  • Start the virtual machine: vagrant up --provision
  • Login to the virtual machine: vagrant ssh
  • Within the VM, switch to your working directory: cd /vagrant/projects

The /vagrant/projects directory on the VM is the same as where you cloned the rails-dev-box repository on your computer. Run any terminal commands via the virtual machine terminal and edit any files using your favourite editor on your Windows or Mac PC.


Need help? Email me: