The following is a thorough ‘setup guide’ for installing rbenv, ruby-build, Ruby, Bundler, Rails, RubyGems and other packages.

Most developers like to spend a bit of time setting up their development workspace. I’m no different, after a number of years tweaking and experimenting the following will detail how I setup my environment for OS X.

There has always been a consistent criteria my development environment needed to meet:

  • Unobtrusive, no modifying core files
  • Flexibility with Ruby versions
  • Minimal configuration
  • Easy to setup new/existing projects

So if you’re a ruby developer or a web developer with the same ideals this should help you get started quickly.

This ‘setup guide’ assumes a clean install of OS X, and the following tools are already installed: Command Line Tools, git and Hombrew.

Install Ruby

OS X comes with Ruby installed (Mavericks/Yosemite even gets version 2.0.0, previously it was only 1.8.7), as we don’t want to be messing with core files we’re going to use the brilliant rbenv and ruby-build to manage and install our Ruby versions for our development environment.

Lets get brewing! We can install both of the required packages using Homebrew, once done we add a line to our ~/.bash_profile and reload our terminal profile.

Let’s install rbenv and ruby-build first:

Note: Add rbenv to ~/.bash_profile so that it loads every time you open a terminal:

Now let’s install Ruby:

After Ruby is installed:

And let’s set it as the global version:

Check if it was set as the global version:

The package we just installed allow us to install different versions of Ruby and specify which version to use on a per project basis and globally. This is very useful to keep a consistent development environment if you need to work in a particular Ruby version.

Note: Now close terminal and open it again, this ensures everything has been reloaded in your shell.

Install Bundler

Bundler manages an application’s dependencies, kind of like a shopping list of other libraries the application needs to work.


Skip r-doc generation. If you use Google for finding your Gem documentation like I do you might consider saving a bit of time when installing gems by skipping the documentation.

Install Ruby on Rails

So far you’ve installed Ruby, if you’re not going to be working with Rails you can pat yourself on the back and start working with Ruby! If you intend to work with Rails then you’ve just got a couple more things to do.

Install SQLite3

SQLite is lightweight SQL service and handy to have installed since Rails defaults to using it with new projects. You may find OS X already provides an (older) version of SQLite3, but in the interests of being thorough we’ll install it anyway as Homebrew will set it to ‘keg-only’ and not interfere with the system version if that is the case.

Installation is simple with Homebrew:

Install Rails

With Ruby installed and the minimum dependencies ready to go Rails can be installed as a Ruby Gem.

If you would like Rails to be a default gem in the future when you install a new version of Ruby you can add it to the default-gems file.

Rails has quite a number of other gem dependencies so don’t be surprised if you see loads of other gems being installed at the same time.


RubyGems, the Ruby package manager, was also installed:

Update to its latest version with:

To install a “gem” (Ruby package), run:

To install without generating the documentation for each gem (faster):

To see what gems you have installed:

To check if any installed gems are outdated:

To update all gems or a particular gem:

RubyGems keeps old versions of gems, so feel free to do come cleaning after updating:

We mainly use Ruby for the CSS pre-processor Compass, which is built on top of Sass: