Just do IT

思うは招く

homebrew update をすると Error: homebrew-core is a shallow clone

問題

$ brew update

をしたら以下のエラーが出た。

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 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. 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!

解決

メッセージにある通り実行する。

git -C "/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core" fetch --unshallow

以下の記事にエラー内容が詳しく書かれている。

[brew update]Error:homebrew-core is a shallow clone.で失敗するのを解決 - Qiita