Staging copy. The live site is highearthorbit.com.

May 21, 2006 · Programming

Setting up and Testing Rails apps on Mac OS X

I've been rapidly prototyping and developing a lot of Ruby on Rails applications. I don't want to run lots of WebBrick servers, or configure lighty. I'd rather just use apache for local development, which is much quicker and doesn't involve ports, and explicitly running stand-alone servers.

The instructions below are the quick, and bare-bones steps needed to get a rails app up for development on a Mac OS X machine.

Create your rails application


$ rails ~/Projects/myapp

Edit your apache config file


You need to setup your apache to know how to handle the /myapp URL request. Put the following at the bottom of your httpd.conf file.

/etc/httpd/httpd.conf


FastCgiServer /Users/username/Projects/myapp/public/dispatch.fcgi
-idle-timeout 120 -initial-env RAILS_ENV=development -processes 1
Alias /myapp/ "/Users/username/Projects/myapp/public/"
Alias /myapp "/Users/username/Projects/myapp/public/"


  Options ExecCGI FollowSymLinks
  AllowOverride all
  Order allow, deny
  Allow from all

Restart Apache


After you've edited the file, you need to restart apache:
$ sudo apachectl graceful

Set the rails base address


Now you need to let rails know what the base address is for the URL's:
~/Projects/myapp/public/.htaccess

RewriteBase /myapp

Test that it works


Navigate your browser to http://localhost/myapp, and you should see the happy Welcome aboard

Programming · Apple · Web · Rails