20 Oct 2006

I was trying to install a Ruby Gem when I got the following error message:

ERROR:  While executing gem ... (Gem::GemNotFoundException)
    Could not find xhtmldiff (> 0) in the repository

Googling around, I found out that this error may mean that the source cache is corrupt. Sure enough, that was the problem.

To fix it, under Locomotive, I deleted the following file:

/Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/gems/1.8/source_cache

And that fixed it! :)

Add Your Comment

Spam Protection by WP-SpamFree

Clearing the gem source_cache in Ruby

  1. Aral,

    You’ve become my main source for being in the know with Web 2.0. I hope you do consider yourself a journalist, because I am sure you fill that role for many people.
    With that said, I have been seeing you post a lot about Ruby recently, and I wonder what your thoughts on it are in terms of how it compares to other languages out there? More specifically what your thoughts are on several web-related technologies that seem to, until recently, been staying out of the limelight. For instance, any thoughts on how Ruby on Rails compares to PHP? Having become very used to actionscript (and loving it) I find PHP horribly loose in its syntax, to the point of promoting bad coding behavior. I wonder if it is due for a change itself or a changing of the guard. Any comment on haXe or openLaszlo? What should a web developer be learning and using these days?

    Thanks and take care,
    -Ans

    Anselm Bradford
  2. It’s weird,I removed it ,but when i input

    gem install rails –include-dependencies &

    it still complains:
    $ Bulk updating Gem source index for: http://gems.rubyforge.org
    ERROR: While executing gem … (Gem::GemNotFoundException)
    Could not find rails (> 0) in any repository

    then I input :
    cd “

    Mike
  3. thanks, I have encountered the same problem,perhaps. I rmed the source_cache as you did, then

    gem install rails –include-dependencies &

    it still complains:

    Bulk updating Gem source index for: http://gems.rubyforge.org
    ERROR: While executing gem … (Gem::GemNotFoundException)
    Could not find rails (> 0) in any repository

    then I checked again :

    cd `gem env gempath`
    cache/ doc/ gems/ specifications/ source_cache

    the file source_cache came back!

    I tried times but it still didn’t work.

    any suggestions? thanks in advance .

    my environment :

    platform : cygwin (works well)
    ruby: ruby 1.8.5 (well too)

    Mike
  4. Hey… I’m experiencing the same problem. I’ve spent about two days playing with this. I think i might’ve finally figured out the solution:

    %gem cleanup
    %sudo gem update

    This seemed to work for me? I was having problems getting on the rubyforge site also…
    The source_cache is always gonna come back by the way.

    Wilson
  5. Thanks, Dude.
    That seems to have worked.
    Also, I liked the talking bunny… nice!

    Rashid
  6. Hi,

    I was googling and trying the suggestions around the web for the same issues on CentOS 4 when I came across your post.

    Worked for me! Thanks a bunch.

    Ryan
  7. Hey Wilson nice tip that one.

    gem cleanup
    gem update

    Thanks

    Warren
  8. Yo, gem cleanup is a sweet command. Wish I knew that one before. I used to delete all the old ones manually with gem uninstall… word. I love ruby too much.

    Matt Di Pasquale
  9. Oh, I think you can also use the -u flag with “sudo gem update” to update your local source cache.

    gem help update

    -u, –[no-]update-sources Update local source cache

    Local source cache must be the source code that gets stored on your computer (locally). I’m not sure though. Anyone have a better idea?

    also

    sudo gem update –system

    is a nice command to use before

    sudo gem update

    to update your gem system

    Matt Di Pasquale
  10. hi,

    I am using Ruby in Windows I did all the solution you have said.

    Clearing the source_cache file in C:\ruby\lib\ruby\gems\1.8.

    gem cleanup
    gem update commands

    Its same thing nothing changed. can you tel me some solution for Windows..?

    ~Chethan

    Chethan