RSS
24 Mar 2008

Fixing RubyGems in Ubuntu Gutsy Installation

Author: ceefour | Filed under: Beginner, Complaints, Ruby, Tips, Tools, Tutorials

If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!

Ruby-like firetruck

Upgrading to the latest RubyGems in Ubuntu Gutsy is a bit non-straightforward. I’d like to share a quick fix this time. It’s trivial when you know it, but if not, a friend of mine has almost hosed his system just because of this annoying “bug”.

Installing Ruby in Ubuntu is pretty simple:

sudo aptitude install ruby ri irb rdoc rubygems libruby-extras libmysql-ruby ruby1.8-dev

(add other packages as you see fit)

The problem occurs right after you upgrade RubyGems to the latest version:

sudo gem update --system

Then you get something like this:

ceefour@caliva:/usr/bin$ gem
/usr/bin/gem:23: uninitialized constant Gem::GemRunner (NameError)

Logging in and out doesn’t work. The world is coming to an end!

Don’t worry, the world is still running. Check out your /usr/bin folder:

ceefour@caliva:/usr/bin$ ls -la gem*
-rwxr-xr-x 1 root root 701 2007-08-24 12:18 gem
-rwxr-xr-x 1 root root 698 2008-03-20 09:20 gem1.8
-rwxr-xr-x 1 root root  84 2008-03-20 09:20 gemlock
-rwxr-xr-x 1 root root  89 2008-03-20 09:20 gem_mirror
-rwxr-xr-x 1 root root  76 2008-03-20 09:20 gemri
-rwxr-xr-x 1 root root  89 2008-03-20 09:20 gem_server
-rwxr-xr-x 1 root root  86 2008-03-20 09:20 gemwhich

So, there is some mismatch between gem and gem1.8. The latter being the newer/correct version.

Simply remove the “gem” one and replace (or link) it to the “gem1.8″ one:

ceefour@caliva:/usr/bin$ sudo rm gem
ceefour@caliva:/usr/bin$ sudo ln -s gem1.8 gem

Now:

ceefour@caliva:/usr/bin$ gem -v
1.0.1

Presto! We’re back in business. :-)

Interesting RubyGems articles:

No related posts.

Related posts brought to you by Yet Another Related Posts Plugin.

Tags: error, fix, gem, gems, gutsy, installation, rubygems.ruby, troubleshooting, tutorial, ubuntu, update, upgrade

blog comments powered by Disqus