Skip to main content
Luis de la Rosa

Reinstalling RubyGems on Leopard

So you've got your nice shiny Mac OS X 10.5 Leopard install with all the Ruby goodies you need. Why would you want to reinstall RubyGems? Well the Ruby community moves fast and RubyGems is sort of like Software Update for Ruby. There's also a lot more gems out there that Leopard doesn't come with.

Oh and also you might try some things which break your local rubygems install. Like I did today after a failed attempt at updating to 0.9.5 using

sudo gem update --system

...


~>sudo gem list
/usr/bin/gem:23: uninitialized constant Gem::GemRunner (NameError)
(hmm?)
~>gem list
/usr/bin/gem:23: uninitialized constant Gem::GemRunner (NameError)
(ack)
~>sudo gem update --system
/usr/bin/gem:23: uninitialized constant Gem::GemRunner (NameError)
(uh oh)
~>gem update --system
/usr/bin/gem:23: uninitialized constant Gem::GemRunner (NameError)
(yikes)

Hmm.. that's not good!

One more reason to update your RubyGems is that the 0.9.5 version just came out and Leopard comes with 0.9.4. And yet another reason is that after doing so, it seems like "sudo gem" and "gem" act the same now.

Now before we start, you should:

  1. Open up ~/.bash_profile in your favorite editor (create it if its not already there)
  2. Type in
    export GEM_HOME=/Library/Ruby/Gems/1.8
  3. Type in
    export GEM_PATH=/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8
  4. Save ~/.bash_profile
  5. Execute
    source ~/.bash_profile

This makes it so that no matter what version of rubygems you have, you have access to the Apple-provided gems in $GEM_PATH and you're able to install/update new gems in $GEM_HOME.

Now, download the latest version of RubyGems from http://rubyforge.org/frs/?group_id=126&release_id=16500

Finally, execute

sudo ruby setup.rb

There you go - enjoy your newly re-installed RubyGems! In the future, you should be able to just do a

sudo gem update --system
, but if that fails (which it did for me tonight), then you know how to re-install from scratch.