Clearing the gem source_cache in Ruby

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! :)

7 Responses to “Clearing the gem source_cache in Ruby”


  1. 1 Anselm Bradford

    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

  2. 2 Mike

    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 “

  3. 3 Mike

    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)

  4. 4 Wilson

    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.

  5. 5 Rashid

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

  6. 6 Ryan

    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.

  7. 7 Warren

    Hey Wilson nice tip that one.

    gem cleanup
    gem update

    Thanks

Leave a Reply






Bad Behavior has blocked 0 access attempts in the last 7 days.