rbenvはRubyのバージョン管理用のモジュールです。

Gitが入ってない場合はこちらを参考。
Gitをインストールする

 

Gitでrbenvをとruby-buildをダウンロードします。

$ git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
$ git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build

 

.bash_profileを変更します。

$ echo 'export PATH="$HOME/.rbenv/versions/2.2.5/bin:$PATH"' >> ~/.bash_profile 
$ echo 'export PATH="$HOME/.rbenv/versions/2.2.5/lib:$PATH"' >> ~/.bash_profile 
$ echo 'export PATH="$HOME/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/eventmachine-1.2.0.1/lib:$PATH"' >> ~/.bash_profile 

$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
$ echo 'eval "$(rbenv init -)"' >> ~/.bash_profile

$ source ~/.bash_profile

 

rbenvをバージョンを確認します。

$ rbenv --version
おすすめの記事