Read my latest article: Was away on vacation (posted Sun, 11 May 2008 22:33:00 GMT)

Using MacPorts Ruby and Rails after Upgrading to OS X Leopard 15

Posted by Robby Russell Sat, 27 Oct 2007 10:43:00 GMT

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. :-)

Subscribe to my RSS feed Enjoying the content? Be sure to subscribe to my RSS feed.
Comments

Leave a response

  1. Avatar
    Jerome Sat, 27 Oct 2007 10:52:58 GMT

    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 !!!

  2. Avatar
    Geoff Sat, 27 Oct 2007 11:38:00 GMT

    How did you do the upgrade? Clean Install or Archive and Install?

  3. Avatar
    Jerome Sat, 27 Oct 2007 11:42:11 GMT

    just upgrade !

  4. Avatar
    Robby Russell Sat, 27 Oct 2007 12:58:56 GMT

    Geoff, a normal upgrade.

  5. Avatar
    John Sat, 27 Oct 2007 16:16:35 GMT

    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.

  6. Avatar
    Scott Fleckenstein Sat, 27 Oct 2007 19:10:34 GMT

    DTrace and Instruments support was too enticing for me to pass up apple’s stack.

  7. Avatar
    Geoff Sun, 28 Oct 2007 01:35:43 GMT

    Very cool then. I should have my hands on Leopard shortly :D

  8. Avatar
    Garry Schafer Mon, 29 Oct 2007 15:42:48 GMT

    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?

  9. Avatar
    Garry Schafer Mon, 29 Oct 2007 15:44:02 GMT

    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?

  10. Avatar
    Garry Schafer Mon, 29 Oct 2007 15:44:15 GMT

    Sorry.. :(

  11. Avatar
    Rob Sanheim Wed, 07 Nov 2007 16:08:48 GMT

    Just a note – installing postgres via macports is now broken in Leopard.

  12. Avatar
    hkstar Sat, 29 Dec 2007 08:06:05 GMT

    Just another note – installing postgres via macports is now fixed in Leopard. ; )

  13. Avatar
    Evandro Thu, 17 Jan 2008 22:56:49 GMT

    Very cool then.

  14. Avatar
    Regras Thu, 17 Jan 2008 22:58:36 GMT

    Wondering but, Upgrade fail!

  15. Avatar
    Regras Thu, 17 Jan 2008 23:02:06 GMT

    Really Good job!

Share your thoughts... (really...I want to hear them)

Comments