rubygems is giving me some problems, and I was hoping someone here might have an idea what is going on. When I type: sudo gem list I get a bunch of gems that I have uninstalled. For example: $ sudo gem uninstall merb-slices ERROR: While executing gem ... (Gem::InstallError) Unknown gem merb-slices >= 0 But is show up in my gem list. How do I fix this? Is there anyway to rebuild that list? I looked through the docs and couldn't find anything. Thanks!
on 2009-01-15 20:22
on 2009-02-20 21:05
I came across this question several times (and no answers!) while trying to solve almost exactly the same problem only with the rake gem in my case. In the end I explored through the gem code itself and resolve the problem of my gem list being out of synch with my actual gems in a couple of ways: gem cleanup this is the built in command that's supposed to do it for you - I got some errors from it, but it fixed some inconsistencies manually: if you look in your gems directory you see a structure like this: [~/.gem/ruby/1.8] ls bin/ cache/ doc/ gems/ specifications/ Now I had foolishly deleted some gems out of the gems directory, which is how the list got out of synch. So I went into the cache directory and deleted the matching .gem files. "gem list" was still wrong. Next, I went into "specifications" and deleted the .gemspec files that matched my deleted gems. (basically I compared the contents of gems/ and specifications/ and deleted from the latter anything not listed in the former) Now it worked. So it seems that the specifications dir is where "gem list" gets its list. This also seemed to solve my problem of the rake command not finding the rake library. Some other things to note: - The gem FAQ suggests you delete source_cache file - which I did and it didnt hurt (in fact it may have been this that fixed my rake problem - though it definitely didnt fix my gem list problem) - On Mac OS X I have no fewer than 3 different gem locations: - GEM PATHS: - /Library/Ruby/Gems/1.8 - /Users/chris/.gem/ruby/1.8 - /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8 the easiest way to see this list - along with a lot of other useful info is to use "gem env" - Also note that some people have report weird synch problems caused by different installations of the gem command in different parts of their PATH for the super user and their regular user. Which is to say, "gem" and "sudo gem" were running different executables for "gem" and were storing gems in different places and had different environments. This was not the problem I had, but to find out if its your problem run "which gem" and "sudo which gem" and see that they point to the same "gem" hope this helps winawards rhubarb
on 2009-02-20 21:20
Thanks a lot for posting this. That fixed everything.