美文网首页
Homebrew:Mac OS 使用brew工具时报错No re

Homebrew:Mac OS 使用brew工具时报错No re

作者: BaronDu | 来源:发表于2022-05-29 21:23 被阅读0次

使用 brew update 时报错:

情况是有一天要下载brew包,发现update时报错如下。

brew update
Warning: No remote 'origin' in /opt/homebrew/Library/Taps/homebrew/homebrew-cask, skipping update!
Warning: No remote 'origin' in /opt/homebrew/Library/Taps/homebrew/homebrew-core, skipping update!
Warning: No remote 'origin' in /opt/homebrew/Library/Taps/homebrew/homebrew-services, skipping update!
Already up-to-date.

解决办法:

1. 执行doctor检查程序

brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: Suspicious https://github.com/Homebrew/brew git origin remote found.
The current git origin is:
  https://mirrors.ustc.edu.cn/brew.git

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

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

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

2. 然后按照doctor的指示进行操作

git -C "/opt/homebrew" remote set-url origin https://github.com/Homebrew/brew
rm -rf "/opt/homebrew/Library/Taps/homebrew/homebrew-cask"
brew tap homebrew/cask
Warning: No remote 'origin' in /opt/homebrew/Library/Taps/homebrew/homebrew-core, skipping update!
Warning: No remote 'origin' in /opt/homebrew/Library/Taps/homebrew/homebrew-services, skipping update!
Running `brew update --preinstall`...
==> Tapping homebrew/cask
Cloning into '/opt/homebrew/Library/Taps/homebrew/homebrew-cask'...
remote: Enumerating objects: 641773, done.
remote: Counting objects: 100% (157/157), done.
remote: Compressing objects: 100% (89/89), done.
remote: Total 641773 (delta 73), reused 145 (delta 68), pack-reused 641616
Receiving objects: 100% (641773/641773), 303.13 MiB | 370.00 KiB/s, done.
Resolving deltas: 100% (454361/454361), done.
Tapped 4016 casks (4,088 files, 323.7MB).
rm -rf "/opt/homebrew/Library/Taps/homebrew/homebrew-core"
brew tap homebrew/core
Warning: No remote 'origin' in /opt/homebrew/Library/Taps/homebrew/homebrew-services, skipping update!
==> Tapping homebrew/core
Cloning into '/opt/homebrew/Library/Taps/homebrew/homebrew-core'...
remote: Enumerating objects: 1198940, done.
remote: Counting objects: 100% (10/10), done.
remote: Compressing objects: 100% (6/6), done.
remote: Total 1198940 (delta 4), reused 9 (delta 4), pack-reused 1198930
Receiving objects: 100% (1198940/1198940), 484.85 MiB | 1.03 MiB/s, done.
Resolving deltas: 100% (825674/825674), done.
Tapped 3 commands and 6093 formulae (6,433 files, 531.5MB).

3. 再次进行brew update

brew update
Warning: No remote 'origin' in /opt/homebrew/Library/Taps/homebrew/homebrew-services, skipping update!
Error: Fetching /opt/homebrew failed!
Updated 2 taps (homebrew/core and homebrew/cask).

虽然能进行update了,但是还是有一个remote仓库连不上。于是需要将homebrew-services也进行重装.

rm -rf "/opt/homebrew/Library/Taps/homebrew/homebrew-services"
brew tap homebrew/services
==> Tapping homebrew/services
Cloning into '/opt/homebrew/Library/Taps/homebrew/homebrew-services'...
remote: Enumerating objects: 2000, done.
remote: Counting objects: 100% (509/509), done.
remote: Compressing objects: 100% (176/176), done.
remote: Total 2000 (delta 348), reused 441 (delta 325), pack-reused 1491
Receiving objects: 100% (2000/2000), 548.53 KiB | 1.02 MiB/s, done.
Resolving deltas: 100% (903/903), done.
Tapped 1 command (45 files, 700.5KB).

好了终于可以愉快的 brew update brew upgrade了。

相关文章

网友评论

      本文标题:Homebrew:Mac OS 使用brew工具时报错No re

      本文链接:https://www.haomeiwen.com/subject/ttlnprtx.html