We first need a Ruby version manager, we'll use rbenv in this guide. To install rbenv, follow all 5 steps from here: https://github.com/rbenv/rbenv#basic-github-checkout.
Now that we have rbenv and the ruby-build plugin installed, we can start installing Ruby.
Check which versions of Ruby are available
rbenv install --list
Then install the latest version of Ruby (2.3.1
for example)
rbenv install 2.3.1
Note: If this fails, open the log mentioned and check the error, some extra packages might need to be installed.
Set this version as global default
rbenv global 2.3.1
Install bundler, the famous Ruby package manager
gem install bundler
Change default option on Ruby Gem installation to skip documentation. Edit or create a ~/.gemrc
file and add the following line
gem: --no-document
Fetch the latest versions of rbenv
cd ~/.rbenv/
git fetch
git tag
Checkout the latest tag (v1.0.0
for example)
git checkout v1.0.0
Fetch the latest versions of ruby-build
cd ~/.rbenv/plugins/ruby-build/
git fetch
git tag
Checkout the latest tag (v20160130
for example)
git checkout v20160130
The list of available Ruby versions should now be up-to-date
rbenv install --list
If next you want to setup Ruby on Rails, you can follow the Ruby on Rails Guide.