Installs rbenv which is much better than RVM. With git installed run this command on the terminal.
git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
Ruby-build, which simplifies the way Ruby is installed.
git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
Add rbenv to $ PATH. To do this, execute the following command:
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
Add the boot script to your terminal boot file. Run the command.
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
Restart your terminal to load these new settings, or run the command source ~/.bashrc.
If everything went well. Now you can install ruby. To find out which versions are available, run the command rbenv install -l.
$ rbenv install -l
Available versions:
1.8.6-p383
1.8.6-p420
1.8.7-p249
1.8.7-p302
1.8.7-p334
...
To install the latest version available at this time, run the command rbenv install 2.3.1.
This process will take a while, since rbenv will compile Ruby.
When the installation is finished, run the global rbenv 2.3.1 command to set the global version of Ruby /
To display the Ruby version, run the ruby -v command.
Own opinion about rbenv being superior to RMV and the possibility of installing plugins to make your life easier. One of them is rbenv-gem-rehash, which automatically rehashing whenever a gem is installed or removed.
The rbenv init command does this for you, but it is only executed when a new terminal session is started, so any gem installed after this step may not work correctly unless you manually run the rbenv rehash command. "
Run the following command to install the plugin:
$ git clone https://github.com/sstephenson/rbenv-gem-rehash.git ~/.rbenv/plugins/rbenv-gem-rehash
source: Blog Nando Vieira