After upgrading to Snow Leopard I started noticing that whenever I would run sudo gem cleanup it would fail with many errors about being unable to uninstall various gems. I ignored it until the list grew unbearably long but the only solutions I could find on the web were to go through one gem at a time. The errors looked like this:
Attempting to uninstall rails-2.3.5
Unable to uninstall rails-2.3.5:
Gem::InstallError: cannot uninstall, check `gem list -d rails`
...
Following the instructions I then ran gem list -d rails noting the install path for newer gems was now /Library/Ruby/Gems/1.8 whereas the older gems that cleanup was failing on were in /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8. So the solution was to run cleanup once while overriding GEM_HOME as follows:
sudo sh -c 'GEM_HOME=/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8 gem cleanup'
That allowed cleanup to remove the older gems in the old path and now sudo gem cleanup is once again working.
Worked like a charm. Thanks!
Thanks! Cleaned it up very nicely.
thanks~~
Pingback: Ruby Gems errors oplossen (updaten en cleanen) | Daniel van Dorp
This article is very useful. I have used my Mac for years and did not notice my hard disk is consuming by the useless files. This article helped me much. I also found another free cleanup software. http://www.easemac.com It is free and effective.
This is very useful. It worked for me. Thanks. And I tried to use free MacCleaning to do the cleanup as well.