A good Ruby on Rails development environment needs a few things: SSL, image processing, text editor, version control, etc. These notes explain how I setup rails development environments for Mac OS X 10.6 (Snow Leopard).
Step 1. Updating Gems
Before doing anything, it is important to ensure that you are running on the latest gems. To do so:
sudo gem update --system
sudo gem update
Step 2. Enable Web Sharing
Enabling web sharing will startup Apache. To do so ensure System Preferences > Sharing > Web Sharing is selected.

Step 3. Configuring Passenger
Passenger allows for ruby applications (and more specifically rails applications) to be deployed to a Apache and Nginx. Since we just enabled Apache, we can now install it:
sudo gem install passenger
sudo passenger-install-apache2-module
This command will print instructions for finishing up the configuring of passenger. Follow them. You should then be able to run the following command as a test:
sudo apachectl configtest
If everything is good, it should print out “Syntax OK”.
Step 4. Enabling SSL
Apache does not have SSL enabled by default. To enable it uncomment ‘#Include /private/etc/apache2/extra/httpd-ssl.conf’ in ‘/etc/apache2/httpd.conf’. Next we need to generate our certificate:
cd /etc/apache2/
sudo openssl genrsa -out server.key 1024
sudo openssl req -new -x509 -key server.key -out server.crt
sudo chmod 600 server.key server.crt
Again run:
sudo apachectl configtest
And look for “Syntax OK”.
Step 5. Install Port and Image Magick
ImageMagick is required for image processing in some ruby gems (paperclip). To setup, first download and install the latest version of MacPorts from here. Then:
sudo port install ImageMagick
This command takes a long time to run (thirty minutes to an hour). Once it is finished, Apache needs to know about the new binaries. This is done by creating a new file ‘/etc/apache2/other/port.conf’ with contents:
SetEnv PATH /opt/local/bin:/opt/local/sbin:$PATH
Again test apache.
Step 6. Setting Up Hosts
We made it! Now to create our first application. First, we want to map the host name for our application to our development computers IP. The sample ‘/etc/hosts’ file shows the settings required for setting up ‘http://dev.ksylvest.com/’ and ‘http://dev.kwik.ly’:

Next, browse to the directory ‘/etc/apache2/users’ and open the current user’s configuration file (for me ‘/etc/apache2/users/kevin.conf’). Attached is a sample configuration file for the above two applications stored in ‘/Users/kevin/Sites/ksylvest.com’ and ‘/Sites/kevin/Sites/kwik.ly’ respectively:

Again run:
sudo apachectl configtest
If you don’t already have a rails application setup, you can create one in a few steps:
cd ~/Sites
rails ksylvest.com
cd ksylvest.com
rake db:create
rake db:migrate
Then restart the web server:
sudo apachectl restart
Open a browser and test the web application by browsing to the URL specified in the hosts file. The server should also respond to SSL connections after you accept the certificate.
Step 7. Tools
Developing rails on a Mac is great because of the large number of tools available. My favourites include: TextMate, Versions, Git, CSSEdit and Adobe CS4. Some online services exist to help with version control (see GitHub and BeanStalk) so don’t setup local repositories if you can help it! Finally, ruby has many great gems and plugins for simplifying complex tasks in rails: