How to upgrade ruby to a new version in RHEL.

When I try - sudo yum install ruby It says

Package ruby- already installed and latest

version Nothing to do

When I try - sudo yum install @ruby2.5 It says,

Loaded plugins: fastestmirror, langpacks Repository 'UIM_install' is

missing name in configuration, using id Repository 'debug' is missing

name in configuration, using id Repository nodesource is listed more

than once in the configuration Repository nodesource-source is listed

more than once in the configuration Repository 'opencl' is missing

name in configuration, using id Loading mirror speeds from cached

hostfile Group ruby2.5 does not exist. Error: Nothing to do

I need the latest ruby in my system. What is the solution?


I tried sudo yum update ruby and gave the following response.

Loading mirror speeds from cached hostfile

No packages marked for update

  • did you try with yum update ruby Commented Jan 2, 2020 at 9:17
  • Yes, it says - Loading mirror speeds from cached hostfile No packages marked for update
    – Codeformer
    Commented Jan 2, 2020 at 9:18
  • In such case I will not recommend to go further. You can update by hand but you will create good mess with the packages. And this can lead to nonfunctional ruby installation. Commented Jan 2, 2020 at 9:20
  • Okay, but I need a newer version of Ruby as some of the libraries that are used by the project needs later version.
    – Codeformer
    Commented Jan 2, 2020 at 9:22
  • 1
    You can get Ruby 2.6 as part of RedHat Software Collections. These packages will install into alternate directories, so they can co-exist with the base ruby. Commented Jan 2, 2020 at 10:33

4 Answers 4


You can get newer versions of ruby through Red Hat Software Collections.

Once you have the rhscl repo installed you can install the ruby SCL packages. These packages live along side the version of Ruby installed from the base repos, so you won’t use /usr/bin/ruby. The “rh-ruby25” SCL includes Ruby 2.5 but there’s also a Ruby 2.6 (rh-ruby26) if you want a newer one.

The advantage of using SCL is that it is supported by red hat, it gets installed by yum like everything else, and you get security updates. The downside is that it lives along side the base ruby so you need to be careful to load the SCL before using it. Instructions are in the link provided.


In general, I never attempt to use the versions of Ruby (or Rails) packaged on any Linux distro, they are almost always too old for what I need - instead, I download whatever version I need using RVM. If you do this, you'll need to install the newer version of Ruby into a different directory than the distro-provided Ruby, and then you can put that directory into your $PATH ahead of the distro-provided binaries if you wish.


RVM instructions for the lazy (slash people who would rather this nonsense actually worked in the first place):

$ sudo dnf remove ruby

Make sure it doesn't remove any stuff you actually need. Mercifully nothing I had depended on Ruby.

Install RVM (Ruby Version Manager). They make you do a pointless key dance even though it has zero effect on security.

gpg2 --keyserver keyserver.ubuntu.com --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
\curl -sSL https://get.rvm.io | bash -s stable

Start a new shell.

Check https://www.ruby-lang.org/en/downloads/ to see the latest Ruby version. Unfortunately there doesn't seem to be a --latest flag. Boo.

rvm install 3.3.0

It will prompt you for your sudo password so it can install some dependencies (yeay!)

Then it will build Ruby from source. Yes, Ruby has the same insane installation UX as Python. I don't remember Go or Rust building themselves from source when I installed them. Boo.

You will get an error:

Error running 'run_gem_wrappers regenerate',
please read /home/you/.rvm/log/1706528997_ruby-3.3.0/gemset.wrappers.global.log

Google it. Try the first suggestion (install libtool). It was already installed. Try the second suggestion:

sudo dnf install libyaml-devel

Try again

$ rvm install 3.3.0
Already installed ruby-3.3.0.
To reinstall use:

    rvm reinstall ruby-3.3.0

Lies. Try the reinstall version.

Success at last! Who knew upgrading software could be so easy?

Edit: Spoke too soon:

$ rvm use 3.3.0

RVM is not a function, selecting rubies with 'rvm use ...' will not work.

You need to change your terminal emulator preferences to allow login shell.
Sometimes it is required to use `/bin/bash --login` as the command.
Please visit https://rvm.io/integration/gnome-terminal/ for an example.

Don't do what it says; just move the last line of .bash_profile that it added to .bashrc instead.

A simple 12 step process!

To save you looking up yet another command:

rvm --default use 3.3.0

Redhat and centos does not provided the latest version of the various software. This because are LTS (long terms support) operative system. Only security and minor upgrades are released. In order to install an higher version of the software it's better to compile from your self and DON'T REPLACE THE EXISTING VERSION. This because (maybe) the operative system rely on script/tools written with the old particular version. Changing with a different one maybe break something.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .