How to force rubygems or shell to use a certain ve

2020-07-17 04:39发布

问题:

For example, I can install v1.3.6 of bundler on my machine, but the shell will still use v1.11.2:

$ gem install bundler -v 1.3.6
...
1 gem installed

$ bundle -v
Bundler version 1.11.2

To actually use v1.3.6, I have to either explicitely say so every time or uninstall v1.11.2:

$ bundle _1.3.6_ -v
Bundler version 1.3.6

$ gem uninstall bundler -v 1.11.2
...

$ bundle -v
Bundler version 1.3.6

How I can I keep earlier versions of Bundler installed (like 1.11.2) but change the default to another version?

回答1:

Not sure your limitations, but why don't you alias the bundler?

in .bash_rc for one user, or in /etc/bashrc for all users

alias bundle='bundle _1.3.6_'