# Gem cleanup problem

**URL:** <https://rubytalk.org/t/gem-cleanup-problem/52107>\
**Category:** ruby-talk\
**Created:** [4 March 2009 14:27 UTC](https://rubytalk.org/t/gem-cleanup-problem/52107 "2009-03-04T14:27:59Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tom\_Cloyd2](https://avatars.discourse-cdn.com/v4/letter/t/6a8cbe/32.png) [@Tom\_Cloyd2](https://rubytalk.org/u/Tom_Cloyd2)\
**Post date:** [4 March 2009 14:27 UTC](https://rubytalk.org/t/gem-cleanup-problem/52107/1 "2009-03-04T14:27:59Z")

</div>

I'm running Kubuntu Linux 8.10, and Rubygems 1.3.1.

I'm trying to remove a sizable number of outdated gem versions, using the 'gem update' command. Initially, it appeared to be choking on RedCloth. I kept getting:

~$ sudo gem cleanup  
Cleaning up installed gems... Attempting to uninstall RedCloth-4.1.1  
ERROR: While executing gem ... (Gem::InstallError)  
&nbsp;&nbsp;&nbsp;&nbsp;Unknown gem RedCloth = 4.1.1

My immediately previous 'gem list' had shown (among other things) -

RedCloth (4.1.9, 4.1.1)

So I tried to uninstall RedCloth completely, thinking there must be something wrong with it (although I'd seen no indication of this elsewhere). Rubygems reported successfully uninstalling v. 4.1.9. No mention of 4.1.1. It still appeared in the 'gem list'.

Reissuing the command, I get this:

$ sudo gem uninstall RedCloth  
ERROR: While executing gem ... (Gem::InstallError)  
&nbsp;&nbsp;&nbsp;&nbsp;Unknown gem RedCloth \>= 0

So I went after it manually, and just deleted the gem and associated docs.

But the problem just reappeared, with a different gem. Not a RedCloth problem after all.

$ sudo gem cleanup  
Cleaning up installed gems...  
Attempting to uninstall bones-2.3.1  
ERROR: While executing gem ... (Gem::InstallError)  
&nbsp;&nbsp;&nbsp;&nbsp;Unknown gem bones = 2.3.1  
tomc@tomc-desktop:~$

I don't understand the problem here. Can anyone offer me a clue?

Thanks!

Tom

> **···**
>
> --
> 
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
> Tom Cloyd, MS MA, LMHC - Private practice Psychotherapist  
> Bellingham, Washington, U.S.A: (360) 920-1226  
> \<\< [tc@tomcloyd.com](mailto:tc@tomcloyd.com) \>\> (email)  
> \<\< [TomCloyd.com](http://TomCloyd.com) \>\> (website) \<\< [sleightmind.wordpress.com](http://sleightmind.wordpress.com) \>\> (mental health weblog)  
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

---

<div class="post-metadata">

**Author:** ![lasitha](https://avatars.discourse-cdn.com/v4/letter/l/4af34b/32.png) [@lasitha](https://rubytalk.org/u/lasitha)\
**Post date:** [4 March 2009 17:25 UTC](https://rubytalk.org/t/gem-cleanup-problem/52107/2 "2009-03-04T17:25:19Z")

</div>

Tom, sounds a lot like #22770:  
[http://rubyforge.org/tracker/index.php?func=detail&aid=22770&group\_id=126&atid=575](http://rubyforge.org/tracker/index.php?func=detail&aid=22770&group_id=126&atid=575)

Which seems to have a workaround detailed at the bottom of:

> **[Problem with "gem cleanup" on OS X 10.5](https://www.ruby-forum.com/t/problem-with-gem-cleanup-on-os-x-10-5/152840)**
>
> When I try to execute ‘sudo gem cleanup’ on OS X 10.5, I get the message: Attempting to uninstall rails-1.2.6 ERROR: While executing gem . . . (Gem:InstallError) Unknown gem rails = 1.2.6 How can I fix this so gem cleanup will continue to...

HTH,  
lasitha

> **···**
>
> On Wed, Mar 4, 2009 at 7:57 PM, Tom Cloyd \<tomcloyd@comcast.net\> wrote:
> 
> > ~$ sudo gem cleanup  
> > Cleaning up installed gems... Attempting to uninstall RedCloth-4.1.1  
> > ERROR: While executing gem ... (Gem::InstallError)  
> > Unknown gem RedCloth = 4.1.1

---

<div class="post-metadata">

**Author:** ![Eric\_Hodel1](https://avatars.discourse-cdn.com/v4/letter/e/a9adbd/32.png) [@Eric\_Hodel1](https://rubytalk.org/u/Eric_Hodel1)\
**Post date:** [4 March 2009 18:27 UTC](https://rubytalk.org/t/gem-cleanup-problem/52107/3 "2009-03-04T18:27:36Z")

</div>

gem cleanup doesn't handle multiple gem repos well yet, this may be your problem:

$ gem list -d rails

\*\*\* LOCAL GEMS \*\*\*

rails (2.2.2, 1.2.6)  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Author: David Heinemeier Hansson  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Rubyforge: [http://rubyforge.org/projects/rails](http://rubyforge.org/projects/rails)  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Homepage: [http://www.rubyonrails.org](http://www.rubyonrails.org)  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Installed at (2.2.2): /Library/Ruby/Gems/1.8  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(1.2.6): /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8  
[...]  
$ sudo gem cleanup rails  
Password:  
Cleaning up installed gems...  
:0:Warning: Gem::SourceIndex#search support for Regexp patterns is deprecated  
Attempting to uninstall rails-1.2.6  
ERROR: While executing gem ... (Gem::InstallError)  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Unknown gem rails = 1.2.6  
$

> **···**
>
> On Mar 4, 2009, at 06:27, Tom Cloyd wrote:
> 
> > I'm running Kubuntu Linux 8.10, and Rubygems 1.3.1.
> > 
> > I'm trying to remove a sizable number of outdated gem versions, using the 'gem update' command. Initially, it appeared to be choking on RedCloth. I kept getting:
> > 
> > ~$ sudo gem cleanup  
> > Cleaning up installed gems... Attempting to uninstall RedCloth-4.1.1  
> > ERROR: While executing gem ... (Gem::InstallError)  
> > &nbsp;&nbsp;Unknown gem RedCloth = 4.1.1  
> > My immediately previous 'gem list' had shown (among other things) -
> > 
> > RedCloth (4.1.9, 4.1.1)
> > 
> > So I tried to uninstall RedCloth completely, thinking there must be something wrong with it (although I'd seen no indication of this elsewhere). Rubygems reported successfully uninstalling v. 4.1.9. No mention of 4.1.1. It still appeared in the 'gem list'.
> > 
> > Reissuing the command, I get this:
> > 
> > $ sudo gem uninstall RedCloth  
> > ERROR: While executing gem ... (Gem::InstallError)  
> > &nbsp;&nbsp;Unknown gem RedCloth \>= 0  
> > So I went after it manually, and just deleted the gem and associated docs.
> > 
> > But the problem just reappeared, with a different gem. Not a RedCloth problem after all.
> > 
> > $ sudo gem cleanup  
> > Cleaning up installed gems...  
> > Attempting to uninstall bones-2.3.1  
> > ERROR: While executing gem ... (Gem::InstallError)  
> > &nbsp;&nbsp;Unknown gem bones = 2.3.1  
> > tomc@tomc-desktop:~$
> > 
> > I don't understand the problem here. Can anyone offer me a clue?

---

<div class="post-metadata">

**Author:** ![Tom\_Cloyd2](https://avatars.discourse-cdn.com/v4/letter/t/6a8cbe/32.png) [@Tom\_Cloyd2](https://rubytalk.org/u/Tom_Cloyd2)\
**Post date:** [4 March 2009 18:04 UTC](https://rubytalk.org/t/gem-cleanup-problem/52107/4 "2009-03-04T18:04:27Z")

</div>

lasitha wrote:

> **···**
>
> > On Wed, Mar 4, 2009 at 7:57 PM, Tom Cloyd \<tomcloyd@comcast.net\> wrote:  
> > &nbsp;&nbsp;
> > 
> > > ~$ sudo gem cleanup  
> > > Cleaning up installed gems... Attempting to uninstall RedCloth-4.1.1  
> > > ERROR: While executing gem ... (Gem::InstallError)  
> > > &nbsp;&nbsp;Unknown gem RedCloth = 4.1.1  
> > > &nbsp;&nbsp;&nbsp;&nbsp;  
> > > Tom, sounds a lot like #22770:  
> > > [http://rubyforge.org/tracker/index.php?func=detail&aid=22770&group\_id=126&atid=575](http://rubyforge.org/tracker/index.php?func=detail&aid=22770&group_id=126&atid=575)
> > 
> > Which seems to have a workaround detailed at the bottom of:  
> > [Problem with "gem cleanup" on OS X 10.5 - Ruby - Ruby-Forum](http://www.ruby-forum.com/topic/170342)
> > 
> > HTH,  
> > lasitha
> 
> Thanks very much for the assist. I have no knowledge of this problem, so your help is a potential lifesaver - will go check this info. out immediately!
> 
> t.
> 
> --
> 
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
> Tom Cloyd, MS MA, LMHC - Private practice Psychotherapist  
> Bellingham, Washington, U.S.A: (360) 920-1226  
> \<\< tc@tomcloyd.com \>\> (email)  
> \<\< TomCloyd.com \>\> (website) \<\< sleightmind.wordpress.com \>\> (mental health weblog)  
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

---

<div class="post-metadata">

**Author:** ![Tom\_Cloyd2](https://avatars.discourse-cdn.com/v4/letter/t/6a8cbe/32.png) [@Tom\_Cloyd2](https://rubytalk.org/u/Tom_Cloyd2)\
**Post date:** [4 March 2009 18:25 UTC](https://rubytalk.org/t/gem-cleanup-problem/52107/5 "2009-03-04T18:25:40Z")

</div>

lasitha wrote:

> &nbsp;&nbsp;
> 
> > ~$ sudo gem cleanup  
> > Cleaning up installed gems... Attempting to uninstall RedCloth-4.1.1  
> > ERROR: While executing gem ... (Gem::InstallError)  
> > &nbsp;&nbsp;Unknown gem RedCloth = 4.1.1  
> > &nbsp;&nbsp;&nbsp;&nbsp;  
> > Tom, sounds a lot like #22770:  
> > [http://rubyforge.org/tracker/index.php?func=detail&aid=22770&group\_id=126&atid=575](http://rubyforge.org/tracker/index.php?func=detail&aid=22770&group_id=126&atid=575)
> 
> Which seems to have a workaround detailed at the bottom of:  
> [Problem with "gem cleanup" on OS X 10.5 - Ruby - Ruby-Forum](http://www.ruby-forum.com/topic/170342)
> 
> HTH,  
> lasitha

OK, after digesting the information you kindly directed me to, here's what the consensus appears to be:

1. the "gem clean" command is broken, at least some of the time. For me, in my environment, all the time.  
2. the "workaround" is to uninstall each gem and reinstall it. With about 25 gems installed, that definitely a delightful prospect. It's even worse when one considers that, as I documented in my original email, the 'gem uninstall' command is also broken.

Uh...which brings up the subject of tests. I now understand enough about test to suggest that perhaps the test suite for rubygems isn't doing its job. Just a thought. Time for a little "heckle" session?

Oh well. Having 60 gems installed when only 25 are needed is tolerable. Won't need a bailout on this one...!

t.  
But what do I know?

> **···**
>
> > On Wed, Mar 4, 2009 at 7:57 PM, Tom Cloyd \<tomcloyd@comcast.net\> wrote:
> 
> --
> 
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
> Tom Cloyd, MS MA, LMHC - Private practice Psychotherapist  
> Bellingham, Washington, U.S.A: (360) 920-1226  
> \<\< tc@tomcloyd.com \>\> (email)  
> \<\< TomCloyd.com \>\> (website) \<\< sleightmind.wordpress.com \>\> (mental health weblog)  
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

---

<div class="post-metadata">

**Author:** ![Tom\_Cloyd2](https://avatars.discourse-cdn.com/v4/letter/t/6a8cbe/32.png) [@Tom\_Cloyd2](https://rubytalk.org/u/Tom_Cloyd2)\
**Post date:** [4 March 2009 20:56 UTC](https://rubytalk.org/t/gem-cleanup-problem/52107/6 "2009-03-04T20:56:22Z")

</div>

Eric Hodel wrote:

> > I'm running Kubuntu Linux 8.10, and Rubygems 1.3.1.
> > 
> > I'm trying to remove a sizable number of outdated gem versions, using the 'gem update' command. Initially, it appeared to be choking on RedCloth. I kept getting:
> > 
> > ~$ sudo gem cleanup  
> > Cleaning up installed gems... Attempting to uninstall RedCloth-4.1.1  
> > ERROR: While executing gem ... (Gem::InstallError)  
> > &nbsp;&nbsp;Unknown gem RedCloth = 4.1.1  
> > My immediately previous 'gem list' had shown (among other things) -
> > 
> > RedCloth (4.1.9, 4.1.1)
> > 
> > So I tried to uninstall RedCloth completely, thinking there must be something wrong with it (although I'd seen no indication of this elsewhere). Rubygems reported successfully uninstalling v. 4.1.9. No mention of 4.1.1. It still appeared in the 'gem list'.
> > 
> > Reissuing the command, I get this:
> > 
> > $ sudo gem uninstall RedCloth  
> > ERROR: While executing gem ... (Gem::InstallError)  
> > &nbsp;&nbsp;Unknown gem RedCloth \>= 0  
> > So I went after it manually, and just deleted the gem and associated docs.
> > 
> > But the problem just reappeared, with a different gem. Not a RedCloth problem after all.
> > 
> > $ sudo gem cleanup  
> > Cleaning up installed gems...  
> > Attempting to uninstall bones-2.3.1  
> > ERROR: While executing gem ... (Gem::InstallError)  
> > &nbsp;&nbsp;Unknown gem bones = 2.3.1  
> > tomc@tomc-desktop:~$
> > 
> > I don't understand the problem here. Can anyone offer me a clue?
> 
> gem cleanup doesn't handle multiple gem repos well yet, this may be your problem:
> 
> $ gem list -d rails
> 
> \*\*\* LOCAL GEMS \*\*\*
> 
> rails (2.2.2, 1.2.6)  
> &nbsp;&nbsp;&nbsp;&nbsp;Author: David Heinemeier Hansson  
> &nbsp;&nbsp;&nbsp;&nbsp;Rubyforge: [http://rubyforge.org/projects/rails](http://rubyforge.org/projects/rails)  
> &nbsp;&nbsp;&nbsp;&nbsp;Homepage: [http://www.rubyonrails.org](http://www.rubyonrails.org)  
> &nbsp;&nbsp;&nbsp;&nbsp;Installed at (2.2.2): /Library/Ruby/Gems/1.8  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(1.2.6): /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8
> 
> [...]  
> $ sudo gem cleanup rails  
> Password:  
> Cleaning up installed gems...  
> :0:Warning: Gem::SourceIndex#search support for Regexp patterns is deprecated  
> Attempting to uninstall rails-1.2.6  
> ERROR: While executing gem ... (Gem::InstallError)  
> &nbsp;&nbsp;&nbsp;&nbsp;Unknown gem rails = 1.2.6  
> $

Bingo. That's it. I have ruby 1.8.7 installed, and recently installed 1.9 as well. It never occurred to me that Rubygems was catching both installs, and that is clearly the case. Hadn't used the 'gem list -d {}' command until I read your email. Problem explained, if not solved. Interesting....

A day full of bright spots of all sorts!

t.

> **···**
>
> > On Mar 4, 2009, at 06:27, Tom Cloyd wrote:
> 
> --
> 
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
> Tom Cloyd, MS MA, LMHC - Private practice Psychotherapist  
> Bellingham, Washington, U.S.A: (360) 920-1226  
> \<\< tc@tomcloyd.com \>\> (email)  
> \<\< TomCloyd.com \>\> (website) \<\< sleightmind.wordpress.com \>\> (mental health weblog)  
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

---

<div class="post-metadata">

**Author:** ![Eric\_Hodel1](https://avatars.discourse-cdn.com/v4/letter/e/a9adbd/32.png) [@Eric\_Hodel1](https://rubytalk.org/u/Eric_Hodel1)\
**Post date:** [4 March 2009 18:29 UTC](https://rubytalk.org/t/gem-cleanup-problem/52107/7 "2009-03-04T18:29:17Z")

</div>

> Uh...which brings up the subject of tests. I now understand enough about test to suggest that perhaps the test suite for rubygems isn't doing its job. Just a thought.

Some areas are covered very well, others are not.

> Time for a little "heckle" session?

I am eagerly awaiting your patches. Dedicated patch providers get commit.

> **···**
>
> On Mar 4, 2009, at 10:25, Tom Cloyd wrote:

---

<div class="post-metadata">

**Author:** ![lasitha](https://avatars.discourse-cdn.com/v4/letter/l/4af34b/32.png) [@lasitha](https://rubytalk.org/u/lasitha)\
**Post date:** [4 March 2009 19:00 UTC](https://rubytalk.org/t/gem-cleanup-problem/52107/8 "2009-03-04T19:00:03Z")

</div>

As Eric noted, the trouble comes about when you have multiple  
repositories. There may be good reason for such a setup, but if there  
isn't \_and\_ most of your outdated gems are in one of them, you could  
just blow that one away (rm -rf).

In my case the only reason i've had multiple repos is when i forget to  
sudo and end up with gems in ~/.gem. I've blown that one away a  
couple times and that hasn't bothered rubygems any, as far i can tell.

Cheers,  
lasitha.

> **···**
>
> On Wed, Mar 4, 2009 at 11:55 PM, Tom Cloyd \<tomcloyd@comcast.net\> wrote:
> 
> > the consensus appears to be:
> > 
> > 1. the "gem clean" command is broken, at least some of the time. For me, in  
> > my environment, all the time.  
> > 2. the "workaround" is to uninstall each gem and reinstall it. With about 25  
> > gems installed, that definitely a delightful prospect. It's even worse when  
> > one considers that, as I documented in my original email, the 'gem  
> > uninstall' command is also broken.

---

<div class="post-metadata">

**Author:** ![Eric\_Hodel1](https://avatars.discourse-cdn.com/v4/letter/e/a9adbd/32.png) [@Eric\_Hodel1](https://rubytalk.org/u/Eric_Hodel1)\
**Post date:** [5 March 2009 00:41 UTC](https://rubytalk.org/t/gem-cleanup-problem/52107/9 "2009-03-05T00:41:00Z")

</div>

I forgot the workaround:

sudo sh -c 'GEM\_PATH=`gem env home` gem cleanup'

> **···**
>
> On Mar 4, 2009, at 12:56, Tom Cloyd wrote:
> 
> > Eric Hodel wrote:
> > 
> > > > $ sudo gem cleanup  
> > > > Cleaning up installed gems...  
> > > > Attempting to uninstall bones-2.3.1  
> > > > ERROR: While executing gem ... (Gem::InstallError)  
> > > > Unknown gem bones = 2.3.1  
> > > > tomc@tomc-desktop:~$
> > > > 
> > > > I don't understand the problem here. Can anyone offer me a clue?
> > > 
> > > gem cleanup doesn't handle multiple gem repos well yet, this may be your problem:
> > > 
> > > $ gem list -d rails
> > > 
> > > \*\*\* LOCAL GEMS \*\*\*
> > > 
> > > rails (2.2.2, 1.2.6)  
> > > &nbsp;&nbsp;&nbsp;Author: David Heinemeier Hansson  
> > > &nbsp;&nbsp;&nbsp;Rubyforge: [http://rubyforge.org/projects/rails](http://rubyforge.org/projects/rails)  
> > > &nbsp;&nbsp;&nbsp;Homepage: [http://www.rubyonrails.org](http://www.rubyonrails.org)  
> > > &nbsp;&nbsp;&nbsp;Installed at (2.2.2): /Library/Ruby/Gems/1.8  
> > > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(1.2.6): /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8  
> > > [...]  
> > > $ sudo gem cleanup rails  
> > > Password:  
> > > Cleaning up installed gems...  
> > > :0:Warning: Gem::SourceIndex#search support for Regexp patterns is deprecated  
> > > Attempting to uninstall rails-1.2.6  
> > > ERROR: While executing gem ... (Gem::InstallError)  
> > > &nbsp;&nbsp;&nbsp;Unknown gem rails = 1.2.6  
> > > $
> > 
> > Bingo. That's it. I have ruby 1.8.7 installed, and recently installed 1.9 as well. It never occurred to me that Rubygems was catching both installs, and that is clearly the case. Hadn't used the 'gem list -d {}' command until I read your email. Problem explained, if not solved. Interesting....

---

<div class="post-metadata">

**Author:** ![Tom\_Cloyd2](https://avatars.discourse-cdn.com/v4/letter/t/6a8cbe/32.png) [@Tom\_Cloyd2](https://rubytalk.org/u/Tom_Cloyd2)\
**Post date:** [4 March 2009 20:51 UTC](https://rubytalk.org/t/gem-cleanup-problem/52107/10 "2009-03-04T20:51:22Z")

</div>

Eric Hodel wrote:

> > Uh...which brings up the subject of tests. I now understand enough about test to suggest that perhaps the test suite for rubygems isn't doing its job. Just a thought.
> 
> Some areas are covered very well, others are not.

Ahem. Familiar with the problem am I.

> > Time for a little "heckle" session?
> 
> I am eagerly awaiting your patches. Dedicated patch providers get commit.

oh man. Your apparent (if not actual!) faith in my coding abilities is easily the highlight of my day. In only it were true....

t.

> **···**
>
> > On Mar 4, 2009, at 10:25, Tom Cloyd wrote:
> 
> --
> 
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
> Tom Cloyd, MS MA, LMHC - Private practice Psychotherapist  
> Bellingham, Washington, U.S.A: (360) 920-1226  
> \<\< tc@tomcloyd.com \>\> (email)  
> \<\< TomCloyd.com \>\> (website) \<\< sleightmind.wordpress.com \>\> (mental health weblog)  
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

---

<div class="post-metadata">

**Author:** ![Tom\_Cloyd2](https://avatars.discourse-cdn.com/v4/letter/t/6a8cbe/32.png) [@Tom\_Cloyd2](https://rubytalk.org/u/Tom_Cloyd2)\
**Post date:** [5 March 2009 01:26 UTC](https://rubytalk.org/t/gem-cleanup-problem/52107/11 "2009-03-05T01:26:32Z")

</div>

Eric Hodel wrote:

> **···**
>
> > On Mar 4, 2009, at 12:56, Tom Cloyd wrote:
> > 
> > > Eric Hodel wrote:
> > > 
> > > > > $ sudo gem cleanup  
> > > > > Cleaning up installed gems...  
> > > > > Attempting to uninstall bones-2.3.1  
> > > > > ERROR: While executing gem ... (Gem::InstallError)  
> > > > > Unknown gem bones = 2.3.1  
> > > > > tomc@tomc-desktop:~$
> > > > > 
> > > > > I don't understand the problem here. Can anyone offer me a clue?
> > > > 
> > > > gem cleanup doesn't handle multiple gem repos well yet, this may be your problem:
> > > > 
> > > > $ gem list -d rails
> > > > 
> > > > \*\*\* LOCAL GEMS \*\*\*
> > > > 
> > > > rails (2.2.2, 1.2.6)  
> > > > &nbsp;&nbsp;&nbsp;Author: David Heinemeier Hansson  
> > > > &nbsp;&nbsp;&nbsp;Rubyforge: [http://rubyforge.org/projects/rails](http://rubyforge.org/projects/rails)  
> > > > &nbsp;&nbsp;&nbsp;Homepage: [http://www.rubyonrails.org](http://www.rubyonrails.org)  
> > > > &nbsp;&nbsp;&nbsp;Installed at (2.2.2): /Library/Ruby/Gems/1.8  
> > > > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(1.2.6): /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8
> > > > 
> > > > [...]  
> > > > $ sudo gem cleanup rails  
> > > > Password:  
> > > > Cleaning up installed gems...  
> > > > :0:Warning: Gem::SourceIndex#search support for Regexp patterns is deprecated  
> > > > Attempting to uninstall rails-1.2.6  
> > > > ERROR: While executing gem ... (Gem::InstallError)  
> > > > &nbsp;&nbsp;&nbsp;Unknown gem rails = 1.2.6  
> > > > $
> > > 
> > > Bingo. That's it. I have ruby 1.8.7 installed, and recently installed 1.9 as well. It never occurred to me that Rubygems was catching both installs, and that is clearly the case. Hadn't used the 'gem list -d {}' command until I read your email. Problem explained, if not solved. Interesting....
> > 
> > I forgot the workaround:
> > 
> > sudo sh -c 'GEM\_PATH=`gem env home` gem cleanup'
> 
> Ah, lovely. Thanks a lot!
> 
> t.
> 
> --
> 
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
> Tom Cloyd, MS MA, LMHC - Private practice Psychotherapist  
> Bellingham, Washington, U.S.A: (360) 920-1226  
> \<\< tc@tomcloyd.com \>\> (email)  
> \<\< TomCloyd.com \>\> (website) \<\< sleightmind.wordpress.com \>\> (mental health weblog)  
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

---

<div class="post-metadata">

**Author:** ![Fernando\_Perez](https://avatars.discourse-cdn.com/v4/letter/f/8797f3/32.png) [@Fernando\_Perez](https://rubytalk.org/u/Fernando_Perez)\
**Post date:** [20 March 2009 00:08 UTC](https://rubytalk.org/t/gem-cleanup-problem/52107/12 "2009-03-20T00:08:29Z")

</div>

> As Eric noted, the trouble comes about when you have multiple  
> repositories. There may be good reason for such a setup, but if there  
> isn't \_and\_ most of your outdated gems are in one of them, you could  
> just blow that one away (rm -rf).
> 
> In my case the only reason i've had multiple repos is when i forget to  
> sudo and end up with gems in ~/.gem. I've blown that one away a  
> couple times and that hasn't bothered rubygems any, as far i can tell.

Hi,

Thanks for the tip, I just run into this issue, and you saved my day. Is  
it safe to do 'rm -rf'? I only want to keep 1 repo.

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).
