Before starting: Make sure you have the necessary folders and permissions — get more information.

Links: Homepage | Downloads
Dependencies: rbenv | OpenSSL
Version: 2.3.1

Get the Code

Switch to /usr/local/src and download the source package.

cd /usr/local/src
curl --remote-name

Extract the archive and move into the folder.

tar -xzvf ruby-VERSION.tar.gz
cd ruby-VERSION

Compile and Install

Configure, compile and install into /usr/local/rbenv/versions/VERSION.

Latest release of OpenSSL does not work. Version 1.0.2h required.

./configure \
  --prefix=/usr/local/rbenv/versions/VERSION \
make install

Set Version

Set the global ruby version to VERSION.

rbenv global VERSION

To see all installed versions, use rbenv versions.

Update rbenv

Rehash the rbenv shims.

rbenv rehash

Verify the Installation

Verify that you have successfully installed Ruby.

ruby --version