Found Elsewhere…


Sandboxing Rails

Published by Robert Bousquet on 2008-05-30 16:13:00 UTC

James Duncan Davidson wrote up a great recipe for installing Rails that I have been pointing people to for a couple years. For some reason it’s now missing from his site so here’s my version of it from memory:

1. Install Apple Developer Tools, available on your OSX DVD or as a free download from

2. Install the Macports package manager for OSX. It will manage the installation of all the libraries we need.

3. Hide the /opt directory from displaying in the OSX Finder gui

$ sudo echo opt >> /.hidden

4. Install MySQL server via MacPorts.

$ sudo port install mysql5 mysql5-server

Configure mysql5 to start automatically at boot by running the following two commands:

$ sudo launchctl load -w /Library/LaunchDaemons/org.macports.mysql5.plist
$ sudo -u mysql mysql_install_db5

5. Install Subversion.

$ sudo port install subversion +tools

6. Install Ruby and related libraries. Note: This is my recipe for the best Ruby 1.8.6 based Rails installation instead of the default Ruby 1.8.7. If you just want the latest version of Ruby, then just skip to 6b.

$ cd /Users/Shared
$ curl -O
$ tar xzf dports.tar.gz

Edit /opt/local/etc/macports/sources.conf and insert the file:///... line before the default port repository line. The last two lines of the file should say:

rsync:// [default]


$ portindex /Users/Shared/dports

7. Follow this series of commands to get Ruby and Rails installed.

$ sudo port install ruby186
$ sudo port install rb-rubygems
$ sudo port install rb-mysql
$ sudo port install rb-termios
$ sudo port install rb-sqlite3
$ sudo gem install rails

8. Optional installs I recommend

$ sudo port install -u git-core +svn +bash_completion
$ sudo port install imagemagick +wmf +gs +tiff
$ sudo gem install rmagick
$ sudo gem install deprec
$ sudo gem install mongrel_cluster

That should give you a firm foundation to start your Rails applications. This recipe has satisfied the needs of 90% of my applications.