Homebrewでbrewが使えない場合の対処方法
開発環境

Homebrewでbrewが使えない場合の対処方法

作成日:2021年06月06日
更新日:2021年06月06日

Homebrew で brew を使うと、Error:homebrew-core is a shallow clone.のエラーが発生しました。

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

どうやら unshallow は時間などのコストがかかるためとのことです。

このままだと、brew が使えないので、エラーを解除したいと思います。

エラーの解決方法は、以下のコマンドを実行します。

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

brew updade

ターミナルで実行すると、

image2

無事、update が完了しました。

ちなみに shallow clone とは、直近の履歴を取得することです。

Homebrew で同様のエラーが発生している場合、ぜひ試してみてください。

© 2023あずきぱんウェブスタジオ