How to install Ruby

Ubuntu ships with ancient versions of the Ruby interpreter and its tools. The preferred method to installing the latest version of Ruby from source is using rbenv.

  • Install and setup rbenv and its ruby-build plugin from source as described here.

  • List the versions of Ruby available for installation:

$ rbenv install -l
  • Pick a fairly recent version for installation from source. For example, I picked:
$ rbenv install 2.1.5

Trying the latest 2.2.0 gave build errors on my system, but I was able to install 2.1.5.

  • After installation is done, set this version of the Ruby interpreter as the default for you:
$ rbenv global 2.1.5
  • Now you can run this Ruby interpreter from your shell:
$ ruby --version

Now you can also install other gems using the gem tool that is also built along with Ruby.

Tried with: rbenv 0.4.0 and Ubuntu 14.04


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.