0

我正在尝试使用 chruby 永久(暂时)将我的 Ruby 版本更新到 2.2.3。目前是 2.0.0。

每次我退出命令行界面时,版本都会恢复到 2.0.0,并且在尝试使用 chruby(在新会话中)选择 2.2.3 时,我会收到“找不到命令:chruby”消息。

要让 2.2.3 再次运行,我必须输入

source /usr/local/opt/chruby/share/chruby/chruby.sh

其次是chruby 2.2.3。这样做允许我在会话期间使用 2.2.3。退出 zsh(这是我正在使用的 shell)导致我不得不再次执行上述操作。

4

1 回答 1

0

You need to configure chruby by adding those lines to your .zshrc. First to enable chruby:

source /usr/local/opt/chruby/share/chruby/chruby.sh

and then to set a default:

chruby 2.2.3

(Those two lines will probably be right next to each other.)

Then when you upgrade Ruby (e.g. to 2.3.0) and want to make it your default, you would edit that line to chruby 2.3.0). Chruby, unlike e.g. RVM, doesn’t keep track of your default Ruby for you, you need to use your shell’s normal mechanisms for setting it.

于 2016-03-06T15:59:47.410 回答