How to remove a default bundler gem

Ly Channa
1 min readJul 16, 2020

From time to time I have this warning

Warning: the running version of Bundler (2.1.2) is older than the version that created the lockfile (2.1.4). We suggest you to upgrade to the version that created the lockfile by running `gem install bundler:2.1.4

Now I can inspect

gem list bundler

The result show bundler 2.1.2 is the default. The default is the one that will be used.

Even you try to install bundler 2.1.4

gem install bunder:2.1.4 # or even with the --default

As default gems are not allowed to be uninstalled, I found this ruby code from https://github.com/rubygems/bundler/issues/7107#issuecomment-572296292

File.join Gem.default_specifications_dir

The code returns the directory where default gems reside. You can find the gemspec file and delete it manually.

I found that after deleting the bundler-2.1.2.gemspec from the directory, bundle command still complaint with the warning above then I try this

gem install bundler:2.1.2 # reinstall but not as a default one
rbenv rehash
bundler

Then bundler command maps the version correctly and eventually the warnings’ gone.

--

--