brew 安装冻结

brew install Freezing

我在使用 brew install <PackageName>

时遇到问题

我有 macOS BigSur 并且可以轻松使用像 brew 这样的命令但是在最近的降级中 (Mojave)我不能再这样了

它冻结了大约 60 秒并回复(如果我做对了)无法更新主存储库


代码:

Updating Homebrew...
error: Not a valid ref: refs/remotes/origin/master
fatal: ambiguous argument 'refs/remotes/origin/master': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: Could not resolve HEAD to a revision
==> Homebrew has enabled anonymous aggregate formula and cask analytics.
Read the analytics documentation (and how to opt-out) here:
  https://docs.brew.sh/Analytics
No analytics have been recorded yet (nor will be during this `brew` run).

==> Homebrew is run entirely by unpaid volunteers. Please consider donating:
  https://github.com/Homebrew/brew#donations
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/cask).
==> New Casks
8x8-work                 disk-expert              guilded                  odbc-manager             ubports-installer
diagnostics              duplicate-file-finder    hush                     pktriot
==> Updated Casks
Updated 352 casks.
==> Deleted Casks
adafruit-arduino                           beautune                                   caramba-switcher
adobe-lens-profile-creator                 blue-jeans-browser-plugin

Warning: No available formula or cask with the name "htop".
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
==> 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.

Homebrew 由 git 存储库管理。从输出中,homebrew 已分离并且缺少 homebrew-core 回购协议。

让我们尝试按照以下命令修复存储库。

# Reset remote repo for Homebrew, the pkg manager itself
git -C "$(brew --repo)" remote set-url origin https://github.com/Homebrew/brew.git

# Reset origin for homebrew taps
BREW_TAPS="$(brew tap)"
for tap in core cask{,-fonts,-drivers,-versions}; do
    if echo "$BREW_TAPS" | grep -qE "^homebrew/${tap}$"; then
        git -C "$(brew --repo homebrew/${tap})" remote set-url origin https://github.com/Homebrew/homebrew-${tap}.git
    fi
done

brew update-reset

如果它不起作用,您可能需要重新安装 Homebrew。