gem cleanup is now spitting out errors

forrie's Avatar


19 Aug, 2011 07:04 PM

I recently updated my rubygems (1.8.8) and individual installed gems. When I went to cleanup the old code from previous versions, I'm getting tens of errors like this:

Unable to uninstall mail-2.2.19:
        Gem::InstallError: gem "mail" is not installed

Where they are clearly there:

gem list

mail (2.3.0, 2.2.19)

Is this a new bug that's been introduced or is there an incompatibility with how the older gems were crafted. The latter being the case, what's the right way to correct/fix this?

I did see in previous articles that the solution was to upgrade rubygems; that is not the case here, as I'm running the latest code. Presumably :-)


  1. Support Staff 2 Posted by Luis Lavena on 19 Aug, 2011 07:30 PM

    Luis Lavena's Avatar

    Issue already addressed at RubyGems bug tracker:

    And will be part of next release.

    Thank you for reporting.

  2. Luis Lavena closed this discussion on 19 Aug, 2011 07:30 PM.

  3. Luis Lavena re-opened this discussion on 19 Aug, 2011 07:31 PM

  4. Support Staff 3 Posted by Luis Lavena on 19 Aug, 2011 07:32 PM

    Luis Lavena's Avatar

    Sorry, confused this issue with the already reported issues of gem cleanup command.

    Please provide the complete output of gem env and gem list -d mail along with gem cleanup mail --debug -V

    Thank you.

  5. 4 Posted by forrie on 19 Aug, 2011 07:44 PM

    forrie's Avatar

    Thanks for replying. Sorry I didn't pick up on that thread. I also forgot to mention I'm running Ruby Enterprise, which may factor into the problems.

    # gem env
    RubyGems Environment:
      - RUBYGEMS VERSION: 1.8.8
      - RUBY VERSION: 1.8.7 (2011-02-18 patchlevel 334) [i686-linux]
      - INSTALLATION DIRECTORY: /opt/ruby-enterprise-1.8.7-2011.03/lib/ruby/gems/1.8
      - RUBY EXECUTABLE: /opt/ruby-enterprise-1.8.7-2011.03/bin/ruby
      - EXECUTABLE DIRECTORY: /opt/ruby-enterprise-1.8.7-2011.03/bin
        - ruby
        - x86-linux
      - GEM PATHS:
         - /opt/ruby-enterprise-1.8.7-2011.03/lib/ruby/gems/1.8
         - /home/faldrich/.gem/ruby/1.8
         - :update_sources => true
         - :verbose => true
         - :benchmark => false
         - :backtrace => false
         - :bulk_threshold => 1000

    (using a different gem)

    # gem list -d rack-mount   
    *** LOCAL GEMS ***
    rack-mount (0.8.2, 0.8.1, 0.6.14)
        Author: Joshua Peek
        Installed at (0.8.2): /opt/ruby-enterprise-1.8.7-2011.03/lib/ruby/gems/1.8
                     (0.8.1): /opt/ruby-enterprise-1.8.7-2011.03/lib/ruby/gems/1.8
                     (0.6.14): /opt/ruby-enterprise-1.8.7-2011.03/lib/ruby/gems/1.8
        Stackable dynamic tree based Rack router


    # gem cleanup rack-mount --debug -V
    Exception `NameError' at /opt/ruby-enterprise-1.8.7-2011.03/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:177 - uninitialized constant Gem::Commands::CleanupCommand
    Cleaning up installed gems...
    Attempting to uninstall rack-mount-0.8.1
    Exception `Errno::ENOENT' at /opt/ruby-enterprise-1.8.7-2011.03/lib/ruby/1.8/fileutils.rb:1209 - No such file or directory - /opt/ruby-enterprise-1.8.7-2011.03/lib/ruby/gems/1.8/ri/rack-mount-0.8.1-ruby
    Exception `Errno::ENOENT' at /opt/ruby-enterprise-1.8.7-2011.03/lib/ruby/1.8/fileutils.rb:1209 - No such file or directory - /opt/ruby-enterprise-1.8.7-2011.03/lib/ruby/gems/1.8/ri/rack-mount-0.8.1-ruby
    Exception `Errno::ENOENT' at /opt/ruby-enterprise-1.8.7-2011.03/lib/ruby/1.8/fileutils.rb:1304 - No such file or directory - /opt/ruby-enterprise-1.8.7-2011.03/lib/ruby/gems/1.8/ri/rack-mount-0.8.1-ruby
    Successfully uninstalled rack-mount-0.8.1
    Attempting to uninstall rack-mount-0.6.14
    Exception `Gem::InstallError' at /opt/ruby-enterprise-1.8.7-2011.03/lib/ruby/site_ruby/1.8/rubygems/uninstaller.rb:73 - gem "rack-mount" is not installed
    Unable to uninstall rack-mount-0.6.14:
            Gem::InstallError: gem "rack-mount" is not installed
    Clean Up Complete

    Yikes, the Markup/Markdown on this site is not the best...
    Edit: always use the friendly pre tags ;-)

  6. Support Staff 5 Posted by Luis Lavena on 19 Aug, 2011 07:49 PM

    Luis Lavena's Avatar

    OK, so it seems you attempted to uninstall a gem that is installed in /opt/ruby-enterprise- but you didn't use sudo.

    So it cannot cleanup a gem that is not accessible.

    Seems you're not running as root, so that could be the reason.

    Can you try sudo gem cleanup rack-mount ?

  7. 6 Posted by forrie on 19 Aug, 2011 07:50 PM

    forrie's Avatar

    I didn't sudo as I'm working in a root shell.


  8. Support Staff 7 Posted by Luis Lavena on 19 Aug, 2011 07:54 PM

    Luis Lavena's Avatar

    Hmn, then why /home/faldrich/.gem/ruby/1.8 is displayed in the GEM PATHs? :-P

    Perhaps is the issue I first linked associated with it?

    Can you checkout rubygems source, checkout 1.8 branch and run:

    ruby -Ilib bin/gem cleanup rack-mount

  9. 8 Posted by forrie on 19 Aug, 2011 08:06 PM

    forrie's Avatar

    I didn't see that. But I removed my .gem directory -- I don't know how
    it got there to begin with.

    I downloaded the latest tgz, which happens to be 1.8.7 -- worked on a
    couple of gems:

    # ruby -Ilib bin/gem cleanup actionpack
    Cleaning up installed gems...
    Attempting to uninstall actionpack-3.0.9

    You have requested to uninstall the gem:
    actionmailer-3.0.9 depends on [actionpack (= 3.0.9)]
    If you remove this gems, one or more dependencies will not be met.
    Continue with Uninstall? [Yn] y
    Successfully uninstalled actionpack-3.0.9
    Clean Up Complete

    But using a plain cleanup still spits out all the errors I posted about.

  10. Support Staff 9 Posted by Luis Lavena on 19 Aug, 2011 08:13 PM

    Luis Lavena's Avatar

    Let me rephrase my comment:

    Please clone RubyGems repository, not the latest available package.

    As I linked before, there was an issue of cleanup command that was solved but not yet released.

    Repository is here:

    git clone && cd rubygems


    git checkout 1.8

    And try the command I mentioned before.

  11. 10 Posted by forrie on 19 Aug, 2011 08:17 PM

    forrie's Avatar

    I manually iterated over the list of items and now I'm getting a clean
    "gem cleanup" from the system.

    That's not to say that this won't happen again... I did noticed that
    when I got down to 2 or 3 gems left, it was able to handle them on their

  12. Support Staff 11 Posted by Luis Lavena on 23 Aug, 2011 05:11 PM

    Luis Lavena's Avatar

    It has been reported as a bug and solved in the codebase, yet not still released as an update.

    Thank you for your report.

  13. Luis Lavena closed this discussion on 23 Aug, 2011 05:11 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

29 Aug, 2014 06:23 PM
28 Aug, 2014 07:18 PM
27 Aug, 2014 12:03 PM
26 Aug, 2014 07:09 PM
26 Aug, 2014 07:07 PM