微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

brew install 冻结

如何解决brew install 冻结

我在使用 brew install <PackageName>

时遇到问题

我有 ma​​cOS 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 repos 管理。从输出中,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。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。