tags:

views:

429

answers:

2

I haven't used Ruby for a while on my Mac. Obviously something has changed in my environment as gem is no longer working as it should.

Some info from my machine, running OSX 10.5.8:

% gem --version
0.9.0

% gem env
Rubygems Environment:
  - VERSION: 0.9.0 (0.9.0)
  - INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/1.8
  - GEM PATH:
     - /usr/local/lib/ruby/gems/1.8
  - REMOTE SOURCES:
     - http://gems.rubyforge.org

The error I'm seeing is:

% sudo gem update --system
Password:
Updating RubyGems...
Attempting remote update of rubygems-update
ERROR:  While executing gem ... (RuntimeError)
    rubygems-update requires builder >= 0

Or if I try to install a new gem:

% sudo gem install bossman
ERROR:  While executing gem ... (Gem::GemNotFoundException)
    Could not find bossman (> 0) in the repository

Some people have recommended clearing out the source_cache file, but this didn't help me. Others recommended:

% gem clean
Cleaning up installed gems...
Clean Up Complete

But that also doesn't help.

Can someone please help me get gem working again? Any insight into the reasoning behind this would be helpful. I know sufficiently little about Ruby and gem to find these error messages cryptic.

EDIT

I tried Derick Bailey's suggestion, but without any luck:

% sudo gem install rubygems-update update_rubygems
Password:
ERROR:  While executing gem ... (RuntimeError)
    rubygems-update requires builder >= 0
+2  A: 

your version of rubygems should support updating, but it's obviously not working. I've been seeing this a lot recently - not just on osx, either.

the "easy" answer is to either re-install your ruby runtime with an updated version of rubygems already packaged with it, or you can install an updated version of rubygems.

for complete instructions on installing rubygems, see http://docs.rubygems.org/read/chapter/3

try running this: gem install rubygems-update update_rubygems

if that doesn't work, you'll need to manually update, which can be done with these instructions: http://docs.rubygems.org/read/chapter/3#page13

Derick Bailey
@Derick, the shell command failed (as indicated in my edit), but downloading and installing RubyGems from scratch seems to have done the trick. Thanks.
Drew Noakes
@Derick, one more thing -- I'm on Ruby version 1.8.4 (from December 2005!) and am wondering what the current defacto version of Ruby is. You mention updating Ruby in your answer, but not how to do so.
Drew Noakes
1.8.6 and 1.8.7 are the current standards for ruby versions. i run 1.8.6 on my windows machines, and 1.8.7 on my macbook pro. i've read several places that the 1.9.x series is a "development" version and not quite ready for production. i'm not sure how true that is, though. as for updating your version - depends on how you installed it in the first place. i use macports on osx. makes installing/updating easy
Derick Bailey
+1  A: 

Ugh, I thought I had fixed these legacy indexes so update_rubygems worked...I guess not. The main problem here is your version of RubyGems is very old, and you'll need to update. Since you can't install gems, (none are listed in the legacy index, in an effort to get you to update) the best thing to do would be to download the .tgz/.zip from http://gemcutter.org/pages/download and run sudo ruby setup.rb.

qrush
@qrush -- thanks for this info. Downloading the complete .tgz file is the only thing that worked. So far, so good.
Drew Noakes
Update: this should be fixed now. if it's not, let me know!
qrush