Skip to main content

brew 坏掉了

· 2 min read

为了体验下 swiftUI,要下载最新的 XCode,下载最新的 XCode 需要更新最新的系统,更新完了以后今天发现 brew 跪了。 报错提示如下:

Error:
homebrew-core is a shallow clone.
To `brew update`, first run:
git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow
This command may take a few minutes to run due to the large size of the repository.
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!

不要相信它的提示,因为操作下来发现并不管用,后来搜了大概了解 brew 在本地是有两个项目文件夹,一个是 homebrew-core,一个是 homebrew-cask,这两个已经不可用,至于为啥不晓得,即便进入这俩的文件夹,进行 git fetch 和 git pull 升级到最新也无效。最后索性将这两个文件夹直接删掉,重新升级:

cd /usr/local/Homebrew/Library/Taps/homebrew
rm -rf homebrew-core homebrew-cask
brew upgrade