需要在Mac上安装Ruby 2.7.2的帮助

问题描述

我正尝试在Mac(最新的操作系统以及所有更新)上安装Ruby版本2.7.2,并执行以下操作

bool isFirstRun = true;
do
{
    if (!isFirstRun) Console.WriteLine();
    isFirstRun = false;

    Console.Write("Give the width of the window between " + MIN_WIDTH + " and " + MAX_WIDTH + ": ");
    widthString = Console.ReadLine();
    width = double.Parse(widthString);

    if (width < MIN_WIDTH)
    {
      Console.WriteLine("Width is too small.");
    }

    if (width > MAX_WIDTH)
    {
      Console.WriteLine("Width is too large.");
    }
} while (width < MIN_WIDTH || width > MAX_WIDTH);

然后

brew update
brew upgrade rbenv ruby-build

所以我尝试按照上面的说明进行操作

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

解决方法

您需要安装最新的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的回答是正确的,但也可以等到此PR合并后:

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

顺便说一句,这个答案不能满足年龄要求,因此,仅供参考,下面是公式发布之前的阶段:

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

,

根据指定的路径读取正确的红宝石版本可能是一个问题。如果您已经安装了其他版本的ruby,则该路径可能不会更新以寻找较新的版本。

本文提供了有关如何在Mac上设置红宝石的大量非常有用的信息: https://stackify.com/install-ruby-on-your-mac-everything-you-need-to-get-going/

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...