Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ruby-build: definition not found: 2.2.1

I want to install new version of ruby by rbenv install 2.2.1, but I get the error

ruby-build: definition not found: 2.2.1
 The following versions contain 2.2.1 in the name:
  rbx-2.2.1
  rbx-2.2.10

Could you please let me know how should I install version 2.2.1?

Thanks in advance!

like image 597
Cror2014 Avatar asked Mar 30 '15 22:03

Cror2014


2 Answers

Most of the answer here use brew command. So in case, you are on Ubuntu, then do these.

cd ~/.rbenv
git pull

cd ~/.rbenv/plugins/ruby-build/
git pull
like image 23
Ken Ratanachai S. Avatar answered Sep 30 '22 18:09

Ken Ratanachai S.


You should upgrade ruby-build to the latest version, ruby-build is an rbenv plugin that provides an rbenv install command to compile and install different versions of Ruby on UNIX-like systems.

Using Homebrew package manager:

brew upgrade ruby-build --HEAD

If ruby-build-HEAD already installed try reinstalling it

brew reinstall ruby-build --HEAD

You can look for the current stable ruby version number at:

https://www.ruby-lang.org/en/downloads/

Then use rbenv to see the upgraded list of available options:

rbenv install --list

Install latest stable version as below (replace 2.2.2 with your version string):

rbenv install 2.2.2
rbenv rehash

To list and verify all installed versions:

rbenv versions

To set as the global ruby version (in this case 2.2.2):

rbenv global 2.2.2

Hope this helps you and everyone else who faces similar situation in future.

like image 116
Reza Hashemi Avatar answered Sep 30 '22 18:09

Reza Hashemi