Using MacPorts Ruby and Rails after Upgrading to OS X Leopard 15
If you previously followed my article, Installing Ruby on Rails and PostgreSQL on OS X, second edition and are now upgrading to OS X Leopard, you’ll want to make a few adjustments to your setup.
First of all, it’s great that Apple has decided to provide Ruby on Rails out of the box.
~ > gem list rails
*** LOCAL GEMS ***
rails (1.2.3)
Web-application framework with template engine, control-flow layer,
and ORM.
How many gems does it come with?
~ > gem list|grep '^[a-z]'|wc -l
29
It’s really great that Apple shipped Leopard pre-installed with 29 gems, especially if you don’t have your entire Rails stack setup already. In my case and for those that have followed my installation process, you don’t need to switch over to this new development stack (yet). I have a lot of time invested in my fully-functionaly MacPorts installation process (PostgreSQL, MySQL, RMagick, Subversion, Git, etc. Since this all working fine on my machine, I’m not ready to make the switch to Apple’s installation.
Don’t Fix it… if it’s not broken!
So, the the first thing that I did was modify my PATH environment variable, which has /usr/bin as the first path that it’ll look at when you try to run commands like ruby, mongrel_rails, gem, etc. You’ll want to modify this and prepend /opt/local/bin: to the front of PATH in your shell configuration. If you’re using bash, this would be… ~/.bashrc. If you’re using zshell like me, ~/.zshrc.
Now, when you start a new Terminal and run gem list, you’ll see all of the gems that you already have installed.
~ > gem list rails < new-host
*** LOCAL GEMS ***
rails (1.2.5, 1.2.4, 1.2.3, 1.1.6)
Web-application framework with template engine, control-flow layer,
and ORM.
Back to my happy gems…
~ > gem list|grep '^[a-z]'|wc -l < new-host
72
Great! Now I can get back to work and spend time playing with the new features in Finder, Mail.app, and iChat instead of installing all of the software dependencies that our development projects have. :-)
Enjoying the content? Be sure to subscribe to my RSS feed.





Don’t know which update of Mac OS 10.4 has included it last year, however with Leopard you can also install a fresh OS on a new machine then import your former settings from another macintosh with the Migration Assistant: yes, now it also imports /opt/local !!!
How did you do the upgrade? Clean Install or Archive and Install?
just upgrade !
Geoff, a normal upgrade.
Thanks for the tip. I was wondering how much time it was going to take and rebuild things. Everything was working with ports and still is now with the change.
DTrace and Instruments support was too enticing for me to pass up apple’s stack.
Very cool then. I should have my hands on Leopard shortly :D
Ok – so if I’m starting from scratch, would it be best to use macports version of ruby and apache? Or is that over kill?
Ok – so if I’m starting from scratch, would it be best to use macports version of ruby and apache? Or is that over kill?
Sorry.. :(
Just a note – installing postgres via macports is now broken in Leopard.
Just another note – installing postgres via macports is now fixed in Leopard. ; )
Very cool then.
Wondering but, Upgrade fail!
Really Good job!