We no longer use our fork of ruby-build. 18.04 is no longer relevant.
We will be installing rbenv and ruby-build from our own fork Show archive.org snapshot , not from the Ubuntu sources.
Installing rbenv
-
Install rbenv Show archive.org snapshot :
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
For Bash:
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc echo 'eval "$(rbenv init -)"' >> ~/.bashrc
For ZSH:
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.zshrc echo 'eval "$(rbenv init -)"' >> ~/.zshrc
Now reinitialize your shell, e.g. by opening a new terminal. Running
type rbenv
should then say "rbenv is a function". -
Install ruby-build Show archive.org snapshot (gives you
rbenv install
):git clone -b local-openssl-for-old-rubies https://github.com/makandra/ruby-build.git ~/.rbenv/plugins/ruby-build
You should now be able to say
rbenv install --list
, and see quite a few rubies. -
Install rbenv-aliases Show archive.org snapshot (allows you to leave out patch levels):
git clone https://github.com/tpope/rbenv-aliases.git ~/.rbenv/plugins/rbenv-aliases rbenv alias --auto
-
Install rbenv-default-gems Show archive.org snapshot (set it up to automatically install
bundler
):git clone https://github.com/rbenv/rbenv-default-gems.git ~/.rbenv/plugins/rbenv-default-gems
Then you can install the required ruby versions:
Install build dependencies. Do this before installing any Rubies via rbenv or you may have to reinstall them Show archive.org snapshot .
apt-get install autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev
Some things that will be helpful when using rbenv:
- Read our basic introduction to rbenv
- Every time you notice a message like
rbenv: version '2.5.5' is not installed
, alias this version to your existing Ruby version e.g.rbenv alias 2.5.5 2.5
(will alias 2.5.5 to the most recent installed version of Ruby 2.5) - There are different ways to switch Ruby versions on rbenv. You should know about them.
- To make your ruby-build aware of new Ruby versions some time later, you need to update the plugin's git directory.
- To install old versions of REE, you need to tweak some files.