Using rbenv on Ubuntu 18.04+

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 Archive , not from the Ubuntu sources.

Installing rbenv

  1. Install rbenv Archive :

    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".

  2. Install ruby-build Archive (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.

  3. Install rbenv-aliases Archive (allows you to leave out patch levels):

    git clone https://github.com/tpope/rbenv-aliases.git ~/.rbenv/plugins/rbenv-aliases
    rbenv alias --auto
    
  4. Install rbenv-default-gems Archive (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 Archive .

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:

Arne Hartherz almost 8 years ago
This website uses short-lived cookies to improve usability.
Accept or learn more