为什么更新自制软件需要很长时间?

问题描述 投票:0回答:8

这是我的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

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

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

homebrew
8个回答
110
投票

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


46
投票

使用调试选项运行brew update:

brew update -d
,看看会发生什么,它挂在哪里。

可能是由于:

  • 网络速度慢。
  • 等待重大更新的转移。
  • 防火墙问题。

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

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

例如,您可以在

http proxy server
找到
127.0.0.1:6152
。您可以将其设置为
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

18
投票

这就是为我解决的问题:

cd /usr/local/Homebrew/Library/Taps/homebrew/
rm -rf homebrew-core
git clone https://github.com/Homebrew/homebrew-core.git

然后再次运行更新:

brew update -d --auto-update --verbose --force --debug

来源:https://discussions.apple.com/thread/253961400


8
投票

我也跑了

mkdir /usr/local/Homebrew/.git/TMP_FETCH_FAILURES

它对我有用


7
投票

我曾经遇到过“悬挂

brew update
”问题,并尝试了迄今为止答案中建议的所有内容,包括:

  • 关闭我的防火墙 - 没有任何改变
  • 使用代理服务器 -
    brew update
    刚刚无法开始获取存储库
  • 弄乱
    TMP_FETCH_FAILURES
    文件/目录 — 没有任何改变
  • 正在运行
    git remote-https origin https://github.com/Homebrew/homebrew-core
    — 命令挂起
  • 重新启动 macOS(这比预期更有帮助)——没有任何改变
  • 运行
    brew cleanup
    brew autoremove
    — 与此主题无关,只是尝试一些事情。
    brew update
  • 的行为没有任何改变
  • 正在运行
    brew doctor
    — 没有任何变化

最终唯一有效的是访问 https://brew.sh/#install 并再次运行提供的安装脚本。问题就这样消失了。


1
投票

对我来说,我只是再次运行它并且它起作用了。我确实使用了 -d 但这应该不重要。


0
投票

我的很奇怪,我跑了

brew update -d --auto-update --verbose --force --debug
,当它挂起时我跑了:

Criss-MacBook-Air:~ cris$ ps -a | grep brew
12161 ttys000    0:00.12 tclsh /opt/homebrew/bin/unbuffer brew update -d --force --verbose --auto-update
12163 ttys001    0:00.03 /bin/bash /opt/homebrew/Library/Homebrew/brew.sh update -d --force --verbose --auto-update
12402 ttys001    0:00.00 /bin/bash /opt/homebrew/Library/Homebrew/brew.sh update -d --force --verbose --auto-update
12462 ttys001    0:00.00 /Applications/Xcode.app/Contents/Developer/usr/libexec/git-core/git remote-https origin https://github.com/Homebrew/homebrew-core
12464 ttys001    0:00.06 /Applications/Xcode.app/Contents/Developer/usr/libexec/git-core/git-remote-https origin https://github.com/Homebrew/homebrew-core
13090 ttys002    0:00.00 grep brew

git-remote-https 也与 shell 窗口中的职位名称匹配。

然后我就奇怪地跑了:

git remote-https origin https://github.com/Homebrew/homebrew-core

以某种方式将它从摊位中启动,然后整个事情又开始缓慢进行,并且很快就完成了。

奇怪


0
投票

这是因为每当你尝试安装某些东西时,苹果都会尝试更新许多其他不相关的东西,但他们为了节省带宽而使下载速度非常慢。 不幸的是,除了换个操作系统之外,没有办法解决这个问题

© www.soinside.com 2019 - 2024. All rights reserved.