mcpolo mcpolo - 1 month ago 5
Bash Question

I cannot update Ruby on Homebrew from 2.0.0 to 2.3.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.

Answer

Use rbenv and plugin ruby-build. It will keep several versions of ruby on the one machine.

After install go to directory with your code, run rbenv install 2.3.1 and create file .ruby-version containing 2.3.1. All scripts running from this directory will use ruby 2.3.1.

Or you will able to set ruby version for all running scripts - rbenv global 2.3.1

Comments