无法使用Homebrew在Mac上安装Ruby

eufgjt7s  于 2023-01-25  发布在  Ruby
关注(0)|答案(2)|浏览(208)

我正在尝试用自制软件安装ruby 3.0。

brew install ruby

但我收到一个错误

Error: No available formula or cask with the name "ruby".
==> Searching for a previously deleted formula (in the last month)...
Error: No previously deleted formula found.
==> Searching taps on GitHub...
Error: No formulae found in taps.

当我尝试'酿造搜索Ruby',我得到这个:

==> Formulae
homebrew/portable-ruby/portable-libyaml
homebrew/portable-ruby/portable-ncurses
homebrew/portable-ruby/portable-openssl
homebrew/portable-ruby/portable-readline
homebrew/portable-ruby/portable-ruby
homebrew/portable-ruby/portable-zlib
==> Casks
rubymine                                 rubymotion

我试着卸载自制程序并重新安装,也使用了brew cleanup。没有任何效果。还有,我的MacOS版本是11. 2. 3(20D91)MacOS Big Sur。

qlvxas9a

qlvxas9a1#

我得到了同样的错误,并运行brew医生给我这个消息:

Warning: Homebrew/homebrew-core was not tapped properly! Run:
  rm -rf "/opt/homebrew/Library/Taps/homebrew/homebrew-core"
  brew tap homebrew/core

尝试运行brew doctor,看看你是否得到相同的结果。
我按照指示做了,耶!我有露比!

xmjla07d

xmjla07d2#

这并不是你问题的确切答案,而是一种替代方法,我建议在使用Ruby和Python等语言时遵循这种方法,因为在这些语言中,你经常需要同时安装多个不同的版本,沿着当你在项目之间移动时,能够在它们之间切换。使用类似RVM的工具。
如果brew无法找到/安装您需要的版本,rvm将从源代码下载并构建它,然后您可以使用rvm use <version>在版本之间切换.当我几年前做大量ruby开发时,我发现它不可或缺,通常,这将是一种比等待自制程序跟上步伐更快的保持最新状态的方法。
其他功能类似的工具包括rbenvchruby

相关问题