Setting up a Rails Development System on Mac OSX Snow Leopard

In this article we’ll follow some easy steps to install and configure properly a Rails Development Environment in Mac OSX Snow Leopard. In our lab test we ran through all the steps in around one hour, considering all download and installing times.

Install XCode

We’ll start installing XCode, the Apple Developer Package. We need it to compile some source packages that we’ll install later. You can install XCode from the original OS X DVD, or you can download it for free from Apple’s website. Since it’s a normal package, you can just click on the package and it will be automatically installed.


Install MacPorts

Now we need MacPorts. Since some of the following needed packages are command line tools, MacPorts will make easy to compile and install them. You can download the pkg file on the MacPorts site. This is a normal OS X package file too, so by clicking on it the MacPorts system will be installed. Let’s test if MacPorts has been installed correctly with the command “port” in the terminal. If everything is fine we should enter the MacPorts interactive mode.

Mac Ports

Install RVM

This is an optional, but very recommended step. We could use the standard Ruby version that comes with OSX, but Ruby Version Manager will allow us to install the latest version and switch between versions, to keep well maintained separated ruby environments. So let’s input in the terminal “sudo gem install rvm“, and then “rvm-install“. Now we have installed RVM, but we need to add to our .profile preference file the following string

[[ -s $HOME/.rvm/scripts/rvm ]] && source $HOME/.rvm/scripts/rvm

Let’s try if everything is working with the command “rvm“.


Install Ruby

Now we can install Ruby using RVM and creating an independent environment from our original OS X system. Let’s start by installing the latest version of Ruby with the command “rvm install 1.9.2“. This command, after downloading the files will compile our new shining latest ruby version.


You can test rvm by switching from version 1.9.2 and the system version, with the command “rvm 1.9.2” and “rvm system“.

RVM Version

Install Rails

Now we’re going to create a set of gems in RVM for our Rails 3 system. Let’s launch the command “rvm use –create 1.9.2@rails3“.

The output will be “Using Ruby 1.9.2 with gemset Rails3“, that is clear and easy to understand. So, let’s install Rails and the db gems with the command “gem install sqlite3-ruby” and “gem install rails“.


Install Passenger

Since we have Apache on OS X, we can install Passenger to use our already installed web server with Rails. Let’s start by installing the gem with “gem install passenger” and then install the Apache2 module to connect Passenger with “rvmsudo passenger-install-apache2-module“.


Passenger Module

Now everything should be in place, we just need to create the passenger configuration file in “/private/etc/apache2/other/passenger.conf“. The first three lines are the code that Passenger installer told us to put into the configuration file. The directory statement simply tells Apache where to look for our projects.

Passenger Configuration

Final Test

Now everything should be in place, so let’s download the Passenger Preference Pane from FingerTips and let’s test our system.

First, let’s create a test Rails app with the command “rails new testApp” launched in our directory “railsApps“.

Test App

Then activate the Apache server with Web Sharing in the Mac Sharing Preferences and add the newly created directory with the Passenger Preference Panel. If you go to the address “testapp.local” in your web browser you should see the standard rails welcome page.


We obviously thank the always up-to-date complete guide from RobbyOnRails and Mark Turner. Now you’re able to explore new frontiers of web programming with Rails!

Please take a minute to chime in and leave a comment below :)

About the author:

Marco Lisci (Web Design/Dev) and Luisa Scarlata (Creative/Copywriter) design and develop for the web, have creative ideas and write award-winning copy. Visit their website at Bad Shark Communications.


Scroll back to the top