8

I just updated the mime-types gem with gem update mime-types. gem list displayed mime-types (1.16) prior to updating. After the update gem list shows mime-types (1.17.2, 1.16). Why are two version displayed?

More info: I have other Rails projects on the same computer. I have not updated the mime-types gem in any other projects. Running gem list from another project's directory (where mime-types has not been updated) displays mime-types (1.16).

3 Answers 3

4

You have both versions installed. If you want to delete old versions (which will not always will be possible due to dependencies) use gem cleanup.

3
  • Interesting. Sounds like gem list displays version numbers for gems in all projects on my machine (as opposed to only the project whose directory gem list is run from). Nov 28, 2011 at 21:42
  • 1
    Gems are installed user-wide or system-wide so yes, it shows gems for all projects.
    – Hauleth
    Nov 28, 2011 at 21:43
  • 1
    To install gems per project you need to use bundle or rvm gemsets.
    – Hauleth
    Jan 3, 2012 at 8:15
1

Which version of RubyGems do you have? gem -v

This is interesting: I have the newest version of RubyGems but my system behaves differently:

gem list => all the gems, all the versions. No matter from where I call it.
gem list --local => same as before but user-wide.

bundle list => all the gems in a project (one version per gem)

The same goes for bundle update and gem update.

bundle update replaces the old version by the new one (the dependencies are taken care by bundler), but gem update keeps both. So if you want to keep only the newest version, run gem cleanup.

bundle outdated might be useful: it displays the outdated gems in your project (based on rubygems.org)

0
1

This can happen because of gem dependencies.

For example if another gem depends on that gem, and the other gem does not have a version specified for it, and(/or) it gets updated and if its dependency on that gem's version changes... well you get the idea.
Sometimes I do a bundle and I see a ton of new versions getting downloaded. All due to changed... dependencies.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.