家里的电脑磁盘空间用光了,导致macOS的升级一直失败,今天有空升级了下系统,升级到macOS Monterey。升级完发现homebrew用不了了。
报错如下:
HEAD is now at 884c4bec1 Merge pull request #14255 from SMillerDev/chore/docs/require_casks_pass_gatekeeper
Error:
homebrew-core is a shallow clone.
homebrew-cask is a shallow clone.
To `brew update`, first run:
git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow
git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask fetch --unshallow
These commands may take a few minutes to run due to the large size of the repositories.
This restriction has been made on GitHub's request because updating shallow
clones is an extremely expensive operation due to the tree layout and traffic of
Homebrew/homebrew-core and Homebrew/homebrew-cask. We don't do this for you
automatically to avoid repeatedly performing an expensive unshallow operation in
CI systems (which should instead be fixed to not use shallow clones). Sorry for
the inconvenience!
Failed during: /usr/local/bin/brew update --force --quiet
问题一:git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow 执行失败。
这个看起来是我之前用了 这个源 的homebrew。 但是它在2020年之后就没更新了,我把源调整为github,也是fetch失败。
最后我把/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core 这个目录给删了,重新执行homebrew的初始化(/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" )。
问题二:raw.githubusercontent.com访问不了。
这两个指令一直执行失败,我尝试重装,也发现失败了。
后来我发现是raw.githubusercontent.com这个域名访问不了。原因如下:
$ nslookup raw.githubusercontent.com
Server: 192.168.3.1
Address: 192.168.3.1
Name: raw.githubusercontent.com
Address: 0.0.0.0
$ nslookup /raw.githubusercontent.com
Server: 192.168.3.1
Address: 192.168.3.1
Non-authoritative answer:
Name: /raw.githubusercontent.com
Address: 185.199.108.133
Name: /raw.githubusercontent.com
Address: 185.199.111.133
Name: /raw.githubusercontent.com
Address: 185.199.109.133
神奇的是,raw.githubusercontent.com的解析居然是0.0.0.0。
看起来是域名解析出错了,调整下hosts就好了
sudo vim /etc/hosts
185.199.109.133 raw.githubusercontent.com
185.199.110.133 raw.githubusercontent.com
185.199.108.133 raw.githubusercontent.com
185.199.111.133 raw.githubusercontent.com
问题三:python2消失了
brew install python@2
brew link --overwrite python@2
重装下就好了。
|