How do I force Bundler to reinstall all of my gems?

Viewed 62096

How do I force Bundler to reinstall all of the gems in my gemfile? Or, how do I force Bundler to uninstall all of the gems it installed so I can then reinstall them myself?


I saw rails bundle clean, but this question explains how to remove gems that bundle installed but are no longer in the gemfile.

And How to reinstall a gem using bundler explains how to reinstall a single gem. I would like to reinstall all of my gems at once.

5 Answers

Brutish but clever:

  1. Comment out your entire Gemfile. (Don't delete it)
  2. bundle clean
  3. Restore your Gemfile.
  4. bundle install

You can also delete the vendor directory and do bundle install again.

Another way to deal with gem problems can be to sudo gem clean instead of reinstalling everything

If you completely want to reinstall everything from scratch you can just, locate your gem dir, for example if you use rvm it would be ~/.rvm/gems then locate your ruby version alongside with gemset for example ruby-2.7.0@some_particular_gemset (it will be a dir) and then just delete it.

rm -rf ruby-2.7.0@some_particular_gemset

bundle install
Related