簡體   English   中英

無法使用 Homebrew 在 Mac 上安裝 Ruby

[英]Unable to install Ruby on Mac with Homebrew

我正在嘗試使用 Homebrew 安裝 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.

當我嘗試“brew search 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。

我遇到了同樣的錯誤並運行了 brew doctor ,它給了我這個消息:

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

嘗試運行 brew doctor 看看你是否得到同樣的結果。

我按照說明進行操作,是的! 我有紅寶石!

這不是您問題的確切答案,而是另一種方法,我建議在使用 Ruby 和 Python 等語言時遵循這種方法,您通常需要同時安裝多個不同的版本,並且能夠在移動時在它們之間切換項目之間:使用像RVM這樣的工具。

如果brew找不到/安裝您需要的版本, rvm將從源下載並構建它,然后您可以使用rvm use <version>在版本之間切換。 幾年前,當我做很多 ruby 開發時,我發現它是不可或缺的,而且通常來說,與等待自制軟件保持同步相比,這將是一種保持最新狀態的更快方法。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM