Howto remove / solve “ruby-build: definition not found or ruby version not found ” on Linux systems


In this mini post I’ll show you how to update your installed ruby version with a higher one not found by ruby-build  on Linux systems (Both RPM Family “Redhat / CentOS  / Scientific Linux and Debian Family “Debian / Ubuntu”). This mini post will solve this error message “ruby-build: definition not found:” which appears when you try to install a new version of ruby using rbenv command on Linux systems.

Here’s what I faced, I was trying to install a new ruby version on my Ruby on Rails application beside the old one installed on my Linux machine using the following command:

$ rbenv install 2.3.1

But , I faced this error:

ruby-build: definition not found: 2.3.1

You can list all available versions with `rbenv install --list'.

If the version you're looking for is not present, first try upgrading
ruby-build. If it's still missing, open a request on the ruby-build
issue tracker:

Solution for that is updating the ruby-build database before installing the new ruby version, run the following commands:

$ cd ~/.rbenv/plugins/ruby-build/
$ git pull

Now, You can safely install the new ruby version “which was in my case 2.3.1” by running the following commands:

$ rbenv install 2.3.1
$ rbenv rehash

Now, check on your current ruby version using the following command:

$ ruby -v
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux]
1. In a rare situation, you may need to update the rbenv database first, then run the above commands.
2. I didn't face this situation and I hope that for you.

Extra point, If the above steps not worked with you, run the following command first then try again the above steps.

$ cd ~/.rbenv
$ git pull

If You Appreciate What We Do Here On Mimastech, You Should Consider:

  1. Stay Connected to: Facebook | Twitter | Google+
  2. Support us via PayPal Donation
  3. Subscribe to our email newsletters.
  4. Tell other sysadmins / friends about Us - Share and Like our posts and services

We are thankful for your never ending support.

Leave a Reply

Your email address will not be published. Required fields are marked *