« Further Eliminations I | Main | Apple Delphic Prediction »

Ruby in OS X Leopard

If you are using Ruby in OS X, I suggest NOT managing it through Fink. OS X comes with Ruby pre-installed. All that is required is to update and install a number of gems as per the Apple Developer Instructions. The instructions also cover configuring Xcode to use for Rails development. After trying both Aptana and the Rails plugin for Eclipse, I suggest the path of least resistance. Xcode is particularly elegant and uncumbersome.

# sudo gem update --system
# sudo gem install rails
# sudo gem update rake
# sudo gem update sqlite3-ruby

Building the PostgreSQL gem requires an additional step as the installed database is managed through Fink (thanks to Roy Hooper fom this one):

# export PATH=/sw/lib/postgresql82/bin/:$PATH
# sudo env ARCHFLAGS="-arch i386" gem install --remote postgres

Modify the environment.rb file to reflect the version of rails installed above. For example, the default scaffold built by the rails command assumes that the version is 2.0.2. To prevent the following error:

Missing the Rails 2.0.2 gem. Please `gem install -v=2.0.2 rails`, 
update your RAILS_GEM_VERSION setting in config/environment.rb for 
the Rails version you do have installed, or comment out RAILS_GEM_VERSION 
to use the latest version installed.

I had to append .9097 to bring the rails version to 2.0.2.9097 for this rails release at the time of writing this article. This will most likely be different for newer versions of rails. The version option for the rails command returns version 2.0.2, but the issuing the following command will return the release number :

# gems list

If you update your gems, you will have to update the environment.rb file with the release version.

I also do not recommend using Aptana. Although it is tempting to use an integrated IDE, there is a bunch of functionality that is buggy (such as the Generators).

TrackBack

TrackBack URL for this entry:
http://www.z1r0.com/mt/mt-tb.cgi/20

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

About

This page contains a single entry from the blog posted on March 26, 2008 6:36 PM.

Many more can be found on the main index page or by looking through the archives.

Colophon

Creative Commons License
This weblog is licensed under a Creative Commons License.