In this tutorial, I will consider you are using OSX, so Homebrew!
Open the terminal and execute:
brew install rbenv
brew install ruby-build
Edit the file:
At the end append the following line:
eval "$(rbenv init -)"
Save and close the file. Load the new configuration. To do it, execute the command:
Afterward, go to the site Ruby and download the newest stable version. For this tutorial, I used the version 2.1.2. In the terminal window execute:
rbenv install 2.1.2
To switch between Rubi versions using RBENV, just type:
rbenv global [versão]
Using global there are other options; take a look at the documentation. So:
rbenv global 2.1.2
Checking the current version:
List all available versions:
Now you can manage which will be the main version and switch between the options using RBENV. Don’t forget to execute:
After installing a new Ruby version or a new Gem in any environment.