【homebrew】homebrew-core / homebrew-cask is a shallow clone. とエラーが出る

  • Mac

Mac にてbrew upgradeを行ったところ、下記のエラーが出ました。

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!

どうも shallow clone が高負荷のため、Github からやめてほしいという要請があった?らしいです。

解決策

エラーに書いてあるとおりですが、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

終われば晴れて upgrade(もしくは update )することができます。

brew upgrade

参考

https://qiita.com/digitalhimiko/items/81184819f6555d4eaa75