What to do after removing a gem from the Gemfile?

You can run just bundle or bundle install to install gems based on your Gemfile. That will remove the instance of mygem from your Gemfile.lock file. It will not, however, remove the gem from your system. To do that, run gem uninstall mygem.

Not completely related, but still helpful:

  • bundle outdated will show you the gems that aren’t on the latest version. Don’t get too tied up with this list – it’s fairly common to have gems that aren’t on the latest version, because some gems are installed as dependencies & one gem might be requiring an older version of another gem.
  • bundle upgrade mygem will upgrade just that gem, and will bring its dependencies up to date. That means that other gems might be upgraded or installed as well.
  • You can search RubyGems to see a gem’s dependencies across each of its versions. As a gem user, you’ll only need to be concerned with the ‘Runtime Dependencies’ list at the bottom of the gem’s page.

Leave a Comment