Using rbenv on Ubuntu 18.04+

Updated . Posted . Visible to the public. Deprecated.

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

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

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

  3. 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
    
  4. 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:

Arne Hartherz
Last edit
Emanuel
License
Source code in this card is licensed under the MIT License.
Posted by Arne Hartherz to makandra dev (2014-09-17 12:42)