Ruby on Rails
MacPorts

MacPorts is a package management system for Mac OSX. It enables various software packages to be installed and updated automatically, without manually configuring or building them. MacPorts is not required to use Ruby or Rails, however it is highly recommended as it greatly simplifies the installation process.

Installing MacPorts

Before starting, be sure you have first installed the Apple Developer Tools (Xcode), which can be downloaded from the Apple Developer Connection site or from your Mac’s accompanying install disc.

For easiest installation, .dmg images containing step-by-step installers can be downloaded from the MacPorts installation page.

Finally, it is a good idea to run the command sudo port -v selfupdate in the terminal to ensure your copy of MacPorts is completely up to date.

Using MacPorts

After installation, you should now have the port command available to you at the command line. port is used to install, upgrade and remove software packages.

For example, the following command will install Ruby and RubyGems:

sudo port install ruby rb-rubygems

Any other necessary packages are downloaded, configured and built automatically – it’s that easy!

Optional Installs

MySQL

MySQL provides a more powerful database than the default SQLite. Install MySQL and its Ruby bindings with:

sudo port install mysql5 rb-mysql

You’ll want to follow the post installation instructions after installing MySQL, most importantly the following command:

sudo /opt/local/bin/mysql_install_db5 --user=mysql

PostgreSQL

Some users perfer the PostgreSQL dabase over others. Use this command to install PostgreSQL:

sudo port install postgresql81 postgresql81-server rb-postgres

Mongrel

Mongrel is a web server suitable for production environments. Once mongrel is installed, using script/server will automatically detect Mongrel and use it instead of the default WEBrick.

sudo gem install mongrel

Lighttpd

Lighttpd is an extremely fast web server, suitable for high-traffic sites. Keep in mind that Mongrel is considerably easier to configure if you are new to Rails.

sudo port install lighttpd

ImageMagick and RMagick

ImageMagick is a powerful image processing library, with RMagick providing a Ruby interface. Install with the following two commands:


sudo port install ImageMagick
sudo gem install rmagick

Git

sudo port install git-core

Subversion

sudo port install subversion