如何强制 rubygems 或 shell 使用特定版本的 gem 的可执行文件?

How to force rubygems or shell to use a certain version of a gem's executable?

例如,我可以在我的机器上安装 v1.3.6 的 bundler,但是 shell 仍然会使用 v1.11.2:

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

$ bundle -v
Bundler version 1.11.2

要真正使用 v1.3.6,我必须每次都明确说明或卸载 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

我怎样才能保留较早版本的 Bundler(如 1.11.2),但将默认版本更改为另一个版本?

不确定你的局限性,但你为什么不给捆绑器起个别名?

in .bash_rc 一个用户,或 /etc/bashrc 所有用户

alias bundle='bundle _1.3.6_'