chruby is a Ruby versioning manager and it’s my favorite Ruby versioning manager. I’ve use it in production server in last few years.

How to Install MRI Ruby with chruby on Ubuntu

CRuby or MRI (Matz’s Ruby Implementation) is original Ruby implementation. To install MRI Ruby with chruby on Ubuntu, you need install all Ruby’s dependencies first.

MRI Ruby Requirements

  • MRI Ruby requires OpenSSL >= 1.0.1.

  • Install the following linux command to install Ruby’s dependencies for Ubuntu. In this case, I use Ubuntu 16.04.

      sudo apt-get install -y build-essential bison zlib1g-dev libyaml-dev libssl-dev libgdbm-dev libreadline-dev libffi-dev
    

MRI Ruby Installation for chruby

wget https://cache.ruby-lang.org/pub/ruby/2.5/ruby-2.5.3.tar.bz2
tar -xjvf ruby-2.5.3.tar.bz2
cd ruby-2.5.3
./configure --prefix=/opt/rubies/ruby-2.5.3
make
sudo make install

How to Uninstall MRI Ruby from chruby

If Ruby installation with chruby use /opt/rubies as target directory, run the following commands to uninstall Ruby from chruby.

rm -r ~/.gem/ruby/2.5.1/
sudo rm -rf /opt/rubies/ruby-2.5.1/