Solved - Ruby gem update failures

Posted by JohnP 09/27/2009 at 08:08

While updating my ruby development environment this morning, I had a few errors. Google was my friend, as usual.

Issue A

Try a gem system update with

 sudo gem update —system

returned
 ERROR:  While executing gem … (Gem::GemNotFoundException)

The fix was to remove the old gem cache directory (your directory can be found `gem env`)
 sudo rm -rf /var/lib/gems/1.8/source_cache

Issue B

 sudo gem update --system

returned

 undefined method `manage_gems’ for Gem:Module (NoMethodError)

Found this blog entry with the fix.
Basically, I had to
 sudo vi /usr/bin/gem

So the file looks like this

require ‘rubygems’
require ‘rubygems/gem_runner’

  1. Gem.manage_gems

to comment out the old gem.manage line and add a new `required` clause.
Anyway, now yahoofinance-1.2.2.gem is installed and ready for use.

As always, ruby and the packages around it are fun to learn. Lots of extra tools that you’ve never heard of and only use directly once every 6 months.

For example, I wasn’t forcing RubyGems to be used with every small program I wrote. Seems there’s an environment variable that can make that automatic. I haven’t decided whether this was a good idea or not, but here it is:

export RUBYOPT=rubygems 

Added it to my ~/.bashrc. Seems strange that it doesn’t contain a path to the gem area on the file system.

Trackbacks

Use the following link to trackback from your own site:
https://blog.jdpfu.com/trackbacks?article_id=333