Fixing RubyGems in Ubuntu Gutsy Installation
Written on March 24, 2008 by Hendy Irawan
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:
- Compiling Ruby, RubyGems and Rails on Ubuntu
- Jag har litet bråttom: Ruby Gems on Ubuntu Linux
- :: nEvEr gIVeUp :: » Ruby, RubyGems Mirroring
- VMUNIX Blues » Blog Archive » Ruby GEMS still doesn’t work on 10.4?
- Stefano’s Blog(s) » The magic world of Ruby, Rails and RubyGems …
- Ruby/RubyGems/Rails/MySQL installation h e double-hockey sticks …



