Gem cleanup problem

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)
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)
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)
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 C., MS MA, LMHC - Private practice Psychotherapist
Bellingham, Washington, U.S.A: (360) 920-1226
<< [email protected] >> (email)
<< TomCloyd.com >> (website)
<< sleightmind.wordpress.com >> (mental health weblog)

lasitha wrote:

Which seems to have a workaround detailed at the bottom of:
Problem with "gem cleanup" on OS X 10.5 - Ruby - Ruby-Forum

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 C., MS MA, LMHC - Private practice Psychotherapist
Bellingham, Washington, U.S.A: (360) 920-1226
<< [email protected] >> (email)
<< TomCloyd.com >> (website)
<< sleightmind.wordpress.com >> (mental health weblog)

On Wed, Mar 4, 2009 at 7:57 PM, Tom C. [email protected] 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

Tom, sounds a lot like #22770:
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:
http://www.ruby-forum.com/topic/170342

HTH,
lasitha

On Mar 4, 2009, at 06:27, Tom C. wrote:

Unknown gem RedCloth = 4.1.1

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)
Author: David Heinemeier H.
Rubyforge: http://rubyforge.org/projects/rails
Homepage: http://www.rubyonrails.org
Installed at (2.2.2): /Library/Ruby/Gems/1.8
(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)
Unknown gem rails = 1.2.6
$

On Mar 4, 2009, at 10:25, Tom C. 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.

Time for a little “heckle” session?

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

lasitha wrote:

Which seems to have a workaround detailed at the bottom of:
Problem with "gem cleanup" on OS X 10.5 - Ruby - Ruby-Forum

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?

Tom C., MS MA, LMHC - Private practice Psychotherapist
Bellingham, Washington, U.S.A: (360) 920-1226
<< [email protected] >> (email)
<< TomCloyd.com >> (website)
<< sleightmind.wordpress.com >> (mental health weblog)

On Wed, Mar 4, 2009 at 11:55 PM, Tom C. [email protected] 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.

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.

Eric H. wrote:

RedCloth-4.1.1

your problem:
(1.2.6):
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.

Tom C., MS MA, LMHC - Private practice Psychotherapist
Bellingham, Washington, U.S.A: (360) 920-1226
<< [email protected] >> (email)
<< TomCloyd.com >> (website)
<< sleightmind.wordpress.com >> (mental health weblog)

On Mar 4, 2009, at 12:56, Tom C. wrote:

gem cleanup doesn’t handle multiple gem repos well yet, this may be
Installed at (2.2.2): /Library/Ruby/Gems/1.8
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’

Eric H. wrote:

On Mar 4, 2009, at 10:25, Tom C. 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.

Tom C., MS MA, LMHC - Private practice Psychotherapist
Bellingham, Washington, U.S.A: (360) 920-1226
<< [email protected] >> (email)
<< TomCloyd.com >> (website)
<< sleightmind.wordpress.com >> (mental health weblog)

Eric H. wrote:

Homepage: http://www.rubyonrails.org
Attempting to uninstall rails-1.2.6

I forgot the workaround:

sudo sh -c ‘GEM_PATH=gem env home gem cleanup’

Ah, lovely. Thanks a lot!

t.

Tom C., MS MA, LMHC - Private practice Psychotherapist
Bellingham, Washington, U.S.A: (360) 920-1226
<< [email protected] >> (email)
<< TomCloyd.com >> (website)
<< sleightmind.wordpress.com >> (mental health weblog)

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.