Create A Rails App With Passenger Phusion On Mac OS X Leopard
This article guides you through the process of creating a Ruby on Rails application using Passenger Phusion (mod_rails) on a Mac OS X Leopard. The article assumes that both Rails and MySQL have already been installed.
Here are the 11 steps to get a Passenger Phusion based Rails app going:
Step 1 - Stop Apache
System Preferences >> Sharing
Uncheck Web Sharing
Step 2 - Install Passenger Gem
$ gem install passenger
Step 3 - Install Apache Module
$ passenger-install-apache2-module
Step 4 - Apache Config Edits
edit /etc/apache2/httpd-conf and add the following three lines:
LoadModule passenger_module /Library/Ruby/Gems/1.8/gems/passenger-2.0.6/ext/apache2/mod_passenger.so
PassengerRoot /Library/Ruby/Gems/1.8/gems/passenger-2.0.6
PassengerRuby /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
Step 5 - Create Virtual Host
This step allows us to access a local Wordpress blog from http://wp.local
Edit /etc/hosts and add the following line:
127.0.0.1 railstestapp.local
Edit /etc/apache2/extra/httpd-vhosts.conf
<VirtualHost *:80>
ServerAdmin webmaster@railstestapp.local
DocumentRoot "/Users/user/Sites/railstestapp/public"
RailsEnv development
ServerName railstestapp.local
ServerAlias *.railstestapp.local
ErrorLog "/private/var/log/apache2/railstestapp.local-error_log"
CustomLog "/private/var/log/apache2/railstestapp.local-access_log" common
</VirtualHost>
The RailsEnv development line is required to run the Rails app in development mode. Also, note that the document root is the public directory.
Step 6- Start Apache
System Preferences >> Sharing
Uncheck Web Sharing
Step 7 - Create a Rails App
$cd /Users/user/Sites
$rails railstestapp
Step 8 - Connect Rails With MySQL Database
Edit your database.yml file in your Rails app so it looks like this:
development:
adapter: mysql
database: railstestapp_development
username: root
password: password
socket: /tmp/mysql.sock
test:
adapter: mysql
database: railstestapp_test
username: root
password: password
socket: /tmp/mysql.sock
production:
adapter: mysql
encoding: utf8
database: railstestapp_production
username: root
password: password
socket: /var/run/mysqld/mysqld.sock
Step 9 - Create the Database
rake db:create
Step 10 - Create Model/Controller/View
ruby script/generate scaffold Post title:string body:string
Step 11 - Try It
http://railstestapp.local/posts
References
The following article gave me the clue on how to set the Rails app in development mode:
http://benr75.com/2008/04/12/setup-mod_rails-phusion-mac-os-x-leopard
Installing Passenger Phusion instructions at: http://www.modrails.com/install.html

TONY Said,
July 21, 2010 @ 7:52 AM
Buy:Synthroid.100% Pure Okinawan Coral Calcium.Accutane.Valtrex.Prednisolone.Retin-A.Prevacid.Zyban.Zovirax.Nexium.Actos.Petcam (Metacam) Oral Suspension.Human Growth Hormone.Arimidex.Lumigan.Mega Hoodia….