Cror2014
Cror2014

Reputation: 447

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!

Upvotes: 19

Views: 23510

Answers (7)

Chalie
Chalie

Reputation: 51

I had the same issue with ruby 3.x.x on Ubuntu 22.04.4. I couldn't get the 3.x.x versions listed with rbenv install -l, so I manually got ruby-build using the command

git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"

after which I could list the 3.x.x versions. I installed the latest version at the time of writing which was 3.3.0 using

rbenv install 3.3.0

Upvotes: 0

rjwhitmer
rjwhitmer

Reputation: 251

Just in case anyone else runs into this issue using the asdf package manager, simply update your plugins by running:

asdf plugin update --all

This will make sure you are on the latest version of ruby-build

Upvotes: 25

Hank Phung
Hank Phung

Reputation: 2149

The easiest way if you're using Linux and have git installed:

git -C ~/.rbenv/plugins/ruby-build pull

Upvotes: 1

Ken Ratanachai S.
Ken Ratanachai S.

Reputation: 3547

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

Upvotes: 21

Reza Hashemi
Reza Hashemi

Reputation: 1837

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.

Upvotes: 24

jvrmed
jvrmed

Reputation: 834

Try to update your ruby-build manually from the repository by using this command:

/Users/your-user/.rbenv/plugins/ruby-build && git pull

Replace "your-user" with your Mac User

Once you've done that you can run the install:

rbenv install 2.2.1

Upvotes: 1

Joshua Turner
Joshua Turner

Reputation: 11

I upgraded homebrew

brew update && brew upgrade

and then was able to upgrade to 2.2.1

rbenv install '2.2.1'

Hope this helps!

Upvotes: 0

Related Questions