Setting up Ruby on Rails and Passenger on a Mac
A set of scripts and instructions on setting up multi-site development for Ruby on Rails projects using Passenger on your mac. Instructions are tailored for my coworkers.
Prerequisites & Preface
In order to do some of these tasks you will need a compiler. On Mac OS X the best way to do this is to install the Apple Developer Tools which can be found on the Mac OS X install disk or online at the Apple Developer Site.
After installing, make sure your path is setup correctly:
echo $PATH # you should see /usr/local/bin:/usr/local/sbin
If you don't see those paths, or you've never changed your path then do this:
And on the first line of that file:
ctrl-o) then exit (
First, let's setup passenger
Passenger is an Apache module to enable Apache to server Ruby on Rails and other Rack based applications. To install:
sudo gem install passenger
Now run the passenger apache setup utility:
Follow the prompts, at the end of the installation process you will be instructed to update your apache configuration file with something along the lines of:
Copy whatever line is displayed and add it to your apache configuration file
/etc/apache2/httpd.conf. This command will open a command line editor
which will allow you to paste in the new line.
sudo nano /etc/apache2/httpd.conf
You may also be able to use Coda, try
command+O and navigating to
or even easier, from the terminal:
Then drag the httpd.conf file onto the Coda icon in your dock. Restart apache and test:
sudo apachectl restart
Then open http://localhost and make sure the default apache site shows up. You should now have passenger installed!
Next, install the vhost scripts
Download these files and unzip them.
Open the terminal and cd root of the folder for this download
Then run the install script:
Make a rails project
Now you should be able to create and enable a rails project.
rails project_name cd project_name sudo sitesetup yourhost.dev project_name/public -H open yourhost.dev
You can use whatever you want for
yourhost.dev and from your
computer you can now use that URL to access your rails site. I like
to use the same host as the production site except replacing