How to update Ruby from the default version to 2.1.6 via terminal

homebrewrubyterminal

I don't want to update my pre-installed Ruby to the latest version.

My question is: how can I upgrade the version of Ruby to version 2.1.6 on Mac via terminal?

Best Answer

Since homebrew has moved on to ruby version 2.4.2 you might not have luck installing that far back a version.

I've not used RVM lately, since I'm happy with keeping up with the ruby version that's stable (and let home brew update things since I have no legacy projects needing 2.1), but give the following steps a shot. This will side load another version that's older than what Apple ships.

Once that's installed:

 rvm install 2.1.6  
 rvm --default use 2.1.6