Simplicity and Clarity by Design

Setting Up My Snow Leopard Ruby 1.9.2, Ruby on Rails 3.0, Nginx, Passenger Development Environment

Snow Leopard ships with Ruby 1.8.7 installed and an older version of Ruby Gems. I am planning on doing some projects with Ruby on Rails and wanted to setup a current environment. My requirements were:

  • Ruby 1.9.2
  • Rails 3.0
  • PostgreSQL 9.0
  • Nginx
  • Passenger

You should download and install the Mac version of PostgreSQL 9.0 from the folks at EnterpriseDB. You will need to register on the site in order to do the download. Be sure to download PostgreSQL 9.0.1, not one of their Plus packages. It is a nicely packaged installer for the freely available version of Postgres.

Once you install this software you should have a file called in the /Library/PostgreSQL/9.0/ directory. This file should be added to your /etc/profile. Here is an example of what mine looks like:

# System-wide .profile for sh(1)

# This has to be set to something in order for path_helper (below)
# to update it with paths found in the /etc/manpaths.d directory.
MANPATH=/usr/local/share/man; export MANPATH

# Setup the PostgreSQL environment.
. /Library/PostgreSQL/9.0/

if [ -x /usr/libexec/path_helper ]; then
    eval `/usr/libexec/path_helper -s`

if [ "${BASH-no}" != "no" ]; then
    [ -r /etc/bashrc ] && . /etc/bashrc

Be sure to log out and log back in before continuing with these instructions. This is important to make sure your PostgreSQL environment variables are set properly.

One of my goals with this setup is to keep everything independent of the default tools that ship with Snow Leopard. To do this I decided that all of my Ruby on Rails setup will be located in the /usr/local/ror directory tree. Here is a script I developed to setup my Ruby on Rails development environment.


# Get and extract a copy of LibYAML
curl > yaml-0.1.3.tar.gz
tar xvf yaml-0.1.3.tar.gz

# Build LibYAML
    cd yaml-0.1.3
    sudo make install

# Get and extract a copy of Ruby 1.9.2
curl > ruby-1.9.2-p0.tar.gz
tar xvf ruby-1.9.2-p0.tar.gz

# Build Ruby 1.9.2
    cd ruby-1.9.2-p0
    ./configure --prefix=/usr/local/ror --with-arch=x86_64 --enable-shared
    make test
    sudo make install

# Update Ruby Gems
sudo gem update --system

# Install Gems
sudo gem install rails
sudo gem install sqlite3-ruby
sudo gem install pg
sudo gem install passenger

# Configure Passenger for Nginx (downloads Nginx and PCRE automatically)
sudo passenger-install-nginx-module --prefix=/usr/local/ror --auto-download --auto

Download the script, un-tar it and place it in any directory you want. I call the script, but you can name it anything you like. Run the script using the command shown below.

$ sh ./

Once the script completes you need to add /usr/local/ror/bin to your path. I did this by editing my /etc/paths file. Here is a copy of the file on my machine:


One more logout/login and you are done. Have fun playing with Ruby on Rails on your Mac!