Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails: How can I remove default version of bundler?

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)
like image 217
SST Avatar asked Aug 01 '19 10:08

SST


People also ask

How do I change the default bundler in Rails?

gem env – try to search in provided list under GEM PATHS, in specifications/default. remove there bundler-VERSION. gemspec. install bundler, if you don't have specific: gem install bundler:VERSION --default.

How do you remove a bundler?

To uninstall Bundler, run gem uninstall bundler . See bundler.io for the full documentation.


3 Answers

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) 
like image 92
Gabriel Cabrera Avatar answered Sep 18 '22 09:09

Gabriel Cabrera


For those who use rbenv, let say by accidentally you have two default versions

$ gem list | grep bundler bundler (default: 2.1.4, default: 1.17.2) 

Check your gem installation path

$ gem environment RubyGems Environment: . . - INSTALLATION DIRECTORY: /home/yohanes/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0 . 

Go to the specifications/default directory and look for bundlers gemspec

$ cd /home/yohanes/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/specifications/default $ ls -lah total 200K drwxr-xr-x 2 yohanes yohanes 4,0K Jun  1 10:05 . drwxr-xr-x 3 yohanes yohanes  20K Jun  1 10:05 .. . . -rw-r--r-- 1 yohanes yohanes  16K Jun  1 10:05 bundler-1.17.2.gemspec -rw-r--r-- 1 yohanes yohanes  15K Jun  1 09:31 bundler-2.1.4.gemspec . . 

Remove the version that you need to remove

$ rm bundler-2.1.4.gemspec 

Check again

$ gem list | grep bundler bundler (default: 1.17.2) $ gem list bundler  *** LOCAL GEMS ***  bundler (default: 1.17.2) 

but, if you check bundle version, you still get the deleted version as default

$ bundler -v Bundler version 2.1.4 

So we have to overrides it by reinstalling the required bundler version again

$ gem install bundler --version '1.17.2' Successfully installed bundler-1.17.2 Parsing documentation for bundler-1.17.2 Done installing documentation for bundler after 1 seconds 1 gem installed 

Then, if you check again it will show you the desired version

$ bundle -v Bundler version 1.17.2 
like image 28
yohanes Avatar answered Sep 17 '22 09:09

yohanes


gem update --system

This command work for me

After run try this gem list bundler

like image 35
Prateek Arora Avatar answered Sep 21 '22 09:09

Prateek Arora