为什么更新自制软件需要永远?

why Updating homebrew takes forever?

这是我的 brew 配置

HOMEBREW_VERSION: 3.0.10-23-g5e0b08d
ORIGIN: https://github.com/Homebrew/homebrew-core
HEAD: 5e0b08dd01bdce3523c7e095739641b6f33b902a
Last commit: 6 hours ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 5e0b08dd01bdce3523c7e095739641b6f33b902a
Core tap last commit: 6 hours ago
Core tap branch: master
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CASK_OPTS: []
HOMEBREW_MAKE_JOBS: 4
Homebrew Ruby: 2.6.3 => /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.3_2/bin/ruby
CPU: quad-core 64-bit icelake
Clang: 12.0 build 1200
Git: 2.24.3 => /Library/Developer/CommandLineTools/usr/bin/git
Curl: 7.64.1 => /usr/bin/curl
macOS: 10.15.7-x86_64
CLT: 12.4.0.0.1.1610135815
Xcode: N/A

当我尝试通过 brewing 下载某些东西时(例如 CAT) 终端显示“正在更新 Homebrew”并且需要很长时间

酿造医生说

 "Warning: Suspicious https://github.com/Homebrew/brew git origin remote found.
The current git origin is:
  https://github.com/Homebrew/homebrew-core

With a non-standard origin, Homebrew won't update properly.
You can solve this by setting the origin remote:
  git -C "/usr/local/Homebrew" remote set-url origin https://github.com/Homebrew/brew"

所以我输入了

git -C "/usr/local/Homebrew" remote set-url origin https://github.com/Homebrew/brew
 However, nothing happened

我对此感到非常沮丧。有人可以帮忙吗?

抱歉写得不好,英语不是我的母语:(

运行 带有调试选项的 brew update:brew update -d,看看会发生什么,它挂在哪里。

可能是由于:

  • 网络慢。
  • 正在等待一个大更新的传输。
  • 防火墙问题。

找到挂起的命令后,尝试 运行 确切终端中的确切命令,以调试问题。

如果是防火墙问题,可以尝试在命令行中使用代理服务器。

例如,您在 127.0.0.1:6152 有一个 http proxy server 可用。您可以将其设置为 git:

git config --global http.proxy http://127.0.0.1:6152
git config --global https.proxy http://127.0.0.1:6152
brew update -d

或者为整个命令行设置代理(只针对支持代理的命令):

export https_proxy=http://127.0.0.1:6152
export http_proxy=http://127.0.0.1:6152
brew update -d

要撤消上述代理配置,请使用:

git config --global --unset http.proxy
git config --global --unset https.proxy

unset https_proxy http_proxy

对我来说,它一直在删除一个名为 TMP_FETCH_FAILURES 的目录,该目录不存在。所以我创建了它然后重新运行并且它起作用了。

对我来说,我只是 运行 再试一次就成功了。我确实使用了 -d 但这应该无关紧要。

出于某些奇怪的原因,在我的情况下,它也卡在删除

/usr/local/Homebrew/.git/TMP_FETCH_FAILURES

但是,我打开了另一个终端 window 并尝试 CD 到这个目录,它立即开始工作。