This article is for developers interested in installing two different versions of Ruby on their system.

Method 1

We'll use brew package manager to help you install rbenv. rbenv is what you will use to install ruby.

Step 1

Remove existing version of rbenv

 rm -rf ~/.rbenv

Step 2

Uninstall rbenv

brew uninstall rbenv

Step 3

Update homebrew

brew update 

Step 4

Installing rbenv through brew

brew install rbenv 

Step 5

Installing ruby-build package

brew install ruby-build 

Method 2

Step 1 - Installing rbenv from Github

git clone https://github.com/sstephenson/rbenv.git ~/.rbenv 

Step 2 - Install ruby 2.x.x

rbenv install 2.x.x

Step 3 - Reload

rbenv rehash

Resources

If you run into any trouble, read below: