In case you're having trouble installing gems...
Posted by chad February 06, 2007 @ 07:54 PM
A significant number of Rails developers have reported problems installing gems with the updated RubyGems release. If you’re experiencing a problem that looks anything like this:
$ gem update sqlite3-ruby Updating installed gems… ERROR: While executing gem … (NoMethodError) undefined
method `refresh’ for #
...you should remove your local source_cache file. This is the file that locally caches any gem metadata from the gem server to avoid having to re-download it every time you execute a gem command.
To discover the location of this file on your system, run the following command:
$ gem env
RubyGems Environment:
- VERSION: 0.9.2 (0.9.2)
- 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 source_cache file should be in the path labeled by GEM PATH. Removing that file should clear up any related issues.
This solution is a workaround pending a fix by the RubyGems team.

Ah, thanks. I’ve wondered why no one else mentioned it on ruby-talk and figured it was a local problem
On my mac, I’ve used MacPorts to upgrade to rb-rubygems 0.9.1, but whenever I call “gem env” it reports 0.8.11. Anyone else seen something similar? I’ve unstalled every rubygem port and reinstalled the latest with the same result.
I’ve updated gems to the latest version, but still get the require_gem warning.
When I do a gem update—system I get:
Updating RubyGems… ERROR: While executing gem … (NoMethodError) undefined method `refresh’ for #<hash:0x14e78b4>
Any help is appreciated.
I did also delete the source_cache file with the same result.
If I do a: rails -v I get: /usr/local/bin/rails:17:Warning: require_gem is obsolete. Use gem instead. Rails 1.2.2
So something didn’t go right.
Looks like macports wasn’t cleaning out the old rubygem files. I did “sudo gem update—system” and it’s fine now.
Then I issued “sudo gem update” and received: “ERROR: While executing gem … (NoMethodError) undefined method `refresh’ for #<hash:0x14fee0c>“
I cleaned out the source_cache and the command ran fine the second time.
dave again,
First delete the source cache. Then gem update—system. Then gem install rails -y. That should clean things up.
ok. tried that. I do sudo gem update—system and get: Updating RubyGems… Bulk updating Gem source index for: http://gems.rubyforge.org Attempting remote update of rubygems-update ERROR: While executing gem … (Gem::GemNotFoundException) Could not find rubygems-update (> 0) in any repository
tried that several times and still wont update. I have the latest version so it appears that it’s erroring out that it can’t find a newer one?
I’m in the same spot as dave again. Help would be appreciated.
Hi, I have a strange problem that I can’t figure out. http://www.ruby-forum.com/topic/95534
Maybe someone have any clue !
Lori, I ran gem update—system again, but left the source_cache file there. it worked fine, then did a gem update rails -y and rails doesn’t complain anymore about the require_gem stuff.
I found that I also needed to delete another copy of the source_cache file in my ~/.gem directory.
I’ve deleted both source_caches and updated my system (I’m on gem 0.9.2), and I still get this while trying a bulk update of my gems:
Attempting remote update of all ERROR: While executing gem … (Gem::GemNotFoundException) Could not find all (> 0) in any repository
I can install new gems properly, and no longer get require warnings, but this seems slightly strange.
Yup – same problem here. deleted both source_caches and a ‘sudo gem update—system’ gives a
ERROR: While executing gem … (Gem::GemNotFoundException) Could not find rubygems-update (> 0) in any repository
I get this: ERROR: Error installing gem gettext-1.9.0.gem[.gem]: undefined method `include?’ for nil:NilClass
The problem is that it’s only happening on some computers. I don’t see why this would work randomly.
I have a similar issue, but instead I get:
ERROR: While executing gem … (NoMethodError) undefined method `[]=’ for #
Any suggestions?
1. I can’t find the “second” source_cache file, don’t have a ~/.gems directory as specified above
2. I tried everything here and its still not working – I can’t run the gems update. Without exception I always get the following when I try to do anything “gem __” :
ERROR: While executing gem … (NoMethodError) undefined method `refresh’ for #<hash:0xb7dcbd58>
please help!