Reputation: 483
bundler (2.0.1, default: 1.17.2)
How could I change the default to 2.0.1
Upvotes: 46
Views: 51732
Reputation: 2164
Following https://bundler.io/guides/bundler_2_upgrade.html#upgrading-applications-from-bundler-1-to-bundler-2, here's what worked for me:
gem install --default bundler
gem update --system
bundle update --bundler
Upvotes: 53
Reputation: 28870
I had this same concern when trying to setup Bundler gem 2.2.11 as the default gem on my machine.
Here's how I achieved it:
First, I listed and uninstalled all other versions of the Bundler gem because I did not need them:
gem list bundler
gem uninstall bundler
If you encounter an error like this
Gem bundler-2.1.4 cannot be uninstalled because it is a default gem
Simply run the command below to get your ruby installation directory:
gem environment | grep "INSTALLATION DIRECTORY"
This should display an output like this. In my case my ruby version was 2.7.2
:
- INSTALLATION DIRECTORY: /home/mycomputer/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0
Next, navigate to the specifications/default
directory of the INSTALLATION PATH
:
cd /home/mycomputer/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/specifications/default
Remove/delete the bundler.gemspec
file that you have there. In my case it was bundler-2.1.4.gemspec
, so I ran the command:
rm bundler-2.1.4.gemspec
Next, I installed the Bundler gem 2.2.11 and made it the default gem:
gem install --default bundler -v 2.2.11
Next, I listed my Bundler versions:
gem list bundler
Finally, I updated my gems to use the newly installed Bundler:
gem update --system
That's all.
I hope this helps
Upvotes: 24
Reputation: 1173
You need to know where the default specs are, so use gem environment
to find out.
the steps I used were:
gem environment
# note INSTALLATION DIRECTORY
cd <installation_dir>
cd specifications/default
rm bundler-2.1.4.gemspec
gem install --default bundler -v 2.2.11
Upvotes: 1
Reputation: 12677
You need to remove .spec
file to remove the gem.
Steps:
gem env
– try to search in provided list under GEM PATHS, in specifications/default
bundler-VERSION.gemspec
gem install bundler:VERSION --default
Upvotes: 10
Reputation: 1240
What helped me is to delete the current default manually from the folder
lib\ruby\gems\2.6.0\specifications\default\
and then install fresh bundler as usually
gem install bundler
or as default
gem install --default bundler
Upvotes: 19