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:
- Open up ~/.bash_profile in your favorite editor (create it if its not already there)
- Type in
export GEM_HOME=/Library/Ruby/Gems/1.8
- Type in
export GEM_PATH=/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8
- Save ~/.bash_profile
- 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.
Thanks for the great tips on how to upgrade to Ruby Gems 0.9.5 on Leopard.
I’m trying to install ruby-debug-ide and ruby complains that it can’t find the header files for ruby. I just upgraded to Leopard.
Todd, did you figure out what your problem was? I am having the same issue.
Why not just leave Leopard files alone, and use Macports
Never touch anything in /usr/ (/usr/lib) actually
Just use macports.
Everything goes to /opt/local/
/opt/local/lib
you have to add this to your ~/.bashrc or ~/.bash_profile
export PATH=/opt/local/bin:/$PATH
I NEVER had a single issue since the 1st day I have my MACBOOK. Which is about 1 year from now, and I work with ruby/rubygems everyday.
is ~/ equal to root?