How to correctly update system ruby version to latest version (2.2.1) on OSX

Use Homebrew but make sure /usr/local/bin is early in your path. Ex:

.bashrc

export PATH=/usr/local/bin:$PATH

This will not update the system Ruby version. Instead it will install another version of ruby and this line tells bash to look for the new version instead.


Easy step

brew uninstall ruby # (if installed)   
brew install ruby   

then copy the path and paste into the terminal and restart the terminal
check ruby --version

enter image description here


echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> ~/.bash_profile

$PATH doesn't change in current Terminal session. So please close the Terminal and reopen.

Ref: Jekyll on macOS

Tags:

Macos

Ruby