15

I'm trying to install Ruby version 2.7.2 on my Mac (latest OS with all updates) and did the following

brew update
brew upgrade rbenv ruby-build

and then

rbenv install 2.7.2
ruby-build: definition not found: 2.7.2

See all available versions with `rbenv install --list'.

If the version you need is missing, try upgrading ruby-build:

  brew update && brew upgrade ruby-build

So I tried following the instructions above and get this

brew update && brew upgrade ruby-build
Already up-to-date.
Warning: ruby-build 20200926 already installed
Andrei Kovrov
  • 2,087
  • 1
  • 18
  • 28
vince
  • 2,374
  • 4
  • 23
  • 39

3 Answers3

35

You need to install the latest ruby-build

$ brew unlink ruby-build # remove STABLE version
$ brew install --HEAD ruby-build 
$ rbenv install -l | grep '2.7.2'
2.7.2


Only latest stable releases for each Ruby implementation are shown.
Use 'rbenv install --list-all' to show all local versions.

Andrei Kovrov
  • 2,087
  • 1
  • 18
  • 28
3

The answer from @andrei-kovrov is correct but, alternatively, you can wait until this PR gets merged:

https://github.com/Homebrew/homebrew-core/pull/62096

Btw, this answer will not age well so, for reference, this is where the formulae are staged before they get released:

https://github.com/Homebrew/homebrew-core/pulls

Daniel
  • 4,051
  • 2
  • 28
  • 46
0

It might be an issue reading the correct version of ruby based on the path that is specified. If you already have another version of ruby installed the path might not be updated to look for a newer version.

This article has a lot of really great information on how to set up ruby on a mac: https://stackify.com/install-ruby-on-your-mac-everything-you-need-to-get-going/

mee_yuhh
  • 36
  • 2