1

I am trying to upgrade Ruby because I need to setup a Jekyll template, and I need to latest version to do it. Since I have a Mac running Sierra, I already have Ruby preinstalled as well as the Homebrew installation. When I install it using brew install ruby, it works, but when I check the version, it is still at 2.0.0 instead of 2.3.1 where it should be. Homebrew says I have 2.3.1, but the CLI says I have 2.0.0. I tried to use brew link --override ruby to make it work, but it said everything was working and it got me nowhere.

4

1 回答 1

2

使用rbenv和插件ruby ​​-build 。它将在一台机器上保留多个版本的 ruby​​。

安装后使用您的代码转到目录,运行rbenv install 2.3.1并创建.ruby-version包含2.3.1. 从该目录运行的所有脚本都将使用 ruby​​ 2.3.1。

或者您将能够为所有正在运行的脚本设置 ruby​​ 版本 -rbenv global 2.3.1

于 2016-10-30T04:31:14.620 回答