rbenv seems to be the preferred tool currently to create and maintain a Ruby environment. It helps install and maintain any version of the Ruby interpreter and other tools. Ubuntu ships with ancient versions of rbenv, so it is not recommended to try that. Instead, installing its source from Github and keeping it updated using Git seems to be the preferred method.
~/.rbenv
. This is the directory where all the programs and files that it uses and maintains will be stored:$ git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
rbenv
binary to your PATH
environment variable:$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
$ echo 'eval "$(rbenv init -)"' >> ~/.bashrc
$ exec $SHELL
$ rbenv
$ git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
ruby-build
is added, you can list what can be installed using rbenv install -l
and install it using rbenv install
.Just update from Github:
$ cd ~/.rbenv
$ git pull
Tried with: rbenv 0.4.0 and Ubuntu 14.04