Rails: How can I remove default version of bundler?

SST picture SST · Aug 1, 2019 · Viewed 25.8k times · Source

I tried to change default bundle version but it getting updated with 2 default version. How can I modify to single default?

$ gem list bundler

*** LOCAL GEMS ***

bundler (2.0.1, default: 1.16.6, default: 1.16.2)

If I do gem uninstall not removing defaults,

$ gem uninstall bundler
Successfully uninstalled bundler-2.0.1


$ gem list bundle

*** LOCAL GEMS ***

bundler (default: 1.16.6, default: 1.16.2)

How can I set (like the below) default as single version?

bundler (2.0.1, default: 1.16.6)

Answer

Gabriel Cabrera picture Gabriel Cabrera · Jan 7, 2020

I had the same problem but with a newer version

$ gem list bundler

*** LOCAL GEMS ***

bundler (default: 2.1.4, default: 2.1.2)

But after following indications on this post Two default versions of rake installed - how to delete one allowed me to deleted one.


You have to delete the .gemspec file corresponding to the default gem you want to delete.

So first, locate where those files are.

# I'm running RVM to manage my Ruby versions

~/.rvm/rubies/ruby-2.7.0/lib/ruby/gems/2.7.0/specifications/default/

-rw-r--r--   1 myuser  staff  10731 Dec 26 17:22 bundler-2.1.2.gemspec
-rw-r--r--   1 myuser  staff  15134 Jan  7 17:30 bundler-2.1.4.gemspec

Delete the one you don't need.

$ rm ~/.rvm/rubies/ruby-2.7.0/lib/ruby/gems/2.7.0/specifications/default/bundler-2.1.2.gemspec

Then install (or reinstall) the gem you want to set as default.

$ gem install bundler:2.1.4 --default

Successfully installed bundler-2.1.4 as a default gem

Finally you'll have installed only the version you wanted.

$ gem list bundler

*** LOCAL GEMS ***

bundler (default: 2.1.4)