https://github.com/sstephenson/rbenv
Installation
$ brew update
$ brew install rbenv ruby-build
$ echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
$ brew update
$ brew upgrade rbenv ruby-build
Run this comamd after you install a new version of ruby, or install that previous commands.
$ rbenv rehash