Radio Bantik:
Days in the Life of an Alpha Geek

Corey Ehmke’s home on the web since 1996, IdolHands.com is an alpha-geek blog covering topics in Ruby on Rails development, Mac OS X, electronics, robotics, and other stuff important in the life of a technologist and tinkerer.

Post-Migration Ruby Leopard Blues

Posted by Corey Ehmke on February 3rd, 2008 in Ruby on Rails | Permanent Link | Share/Save

I finally finished migrating everything over from my old desktop to my new iMac. (I’m still amazed that a consumer-level Mac is more than twice as fast as my old high-end desktop… such is the pace of hardware, of course.)

At any rate, when I started working on one of my Rails projects, I was surprised to see that performance was really poor– much slower that on the old box. Then I realized that my Ruby and Rails installations probably got migrated by Migration Assistant.

Sure enough, ruby -v in Terminal revealed Ruby 1.8.6 for PowerPC/Darwin. This means that Ruby is running in PPC emulation, which explains the performance I was seeing.

Since Leopard ships with Ruby, this means that I now have two versions: in /usr/bin/ruby there’s the version that came with the OS, which is

ruby 1.8.6 (2007-06-07 patchlevel 36) [universal-darwin9.0]

In /usr/local/bin/ruby there’s:

ruby 1.8.6 (2007-03-13 patchlevel 0) [powerpc-darwin8.10.0].

This is obviously a problem…

Some Google time later, I came across this post on Punctuated Productivity; that set me in the right direction for uninstalling the old version and getting the new one up to snuff. His approach was to completely wipe /usr/local/bin and /opt/, which I found a little scary. Here’s a slightly more surgical approach.

  1. Remove the following from /usr/local/bin (sudo, of course):

    gem*
    update_rubygems
    rails
    rake
    mongrel-rails
    cap
    capify
    gpgen
    index_gem_repository.rb
    libpng-config

  2. Unfortunately, I had just installed and configured ImageMagick on the old box, which is a long and tricky process that I’ll have to do all over again. But since it was the only thing that I had installed on that day, so I was able to open ./ to open /usr/local/bin in the Finder, sort by date, and select/delete all of the ImageMagick and RMagick files in a couple of clicks:

    Magick-config
    Wand-config
    animate
    compare
    composite
    conjure
    convert
    display
    freetype-config
    identify
    import
    libpng12-config
    libwmf-config
    libwmf-fontmap
    mogrify
    montage
    pkg-config
    stream
    wmf2eps
    wmf2fig
    wmf2gd
    wmf2svg
    wmf2x
    libpng-config

  3. My last uninstall step was to delete /opt after all, because only MacPorts (which I used to install ImageMagick) had put anything in there.
  4. Now hash -r followed by which ruby correctly reveals /usr/bin/ruby, and ruby -v reports ruby 1.8.6 (2007-06-07 patchlevel 36) [universal-darwin9.0]

    Now to reinstall Rails:

    sudo gem install rails --include-dependencies

    Next I have to reinstall ImageMagick and RMagick, which will hopefully be less painful this time around now that I know about MacPorts…


One Response to “Post-Migration Ruby Leopard Blues”

  1. Tom Söderlund Says:

    Hi,

    I saw your blog post that you have had some problems with multiple Ruby installations on Mac OS X. I think I have similar problems, leading to strange issues with RubyGems (http://www.railsforum.com/viewtopic.php?id=23018) and Aptana RadRails (http://forums.aptana.com/viewtopic.php?p=21960).

    What is best practice here? To:
    1. Delete the OS X files (in /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby)
    2. Delete the MacPorts files (in /opt/local/bin/ruby). If so, should I overwrite the OS X files when new versions are released?
    3. Keep both but change the path somehow?

    Any input would be most helpful.

    Thanks,

    Tom.

Leave a Reply

You must be logged in to post a comment.