Homebrew「homebrew-cask is a shallow clone」の原因と解決方法

  • 作成日 2021.02.12
  • 更新日 2026.06.11
  • mac
Homebrew「homebrew-cask is a shallow clone」の原因と解決方法

Macでbrew update実行時に「Error: homebrew-cask is a shallow clone. To brew update first run:」が発生した場合の対処法を解説します。fetch –unshallowの実行方法や原因、Apple Silicon・Intel Macそれぞれの確認方法まで紹介します。

環境

  • OS  mac 10.15.5

エラー全文

brew update時に発生。

Error: homebrew-cask is a shallow clone. To `brew update` first run:
  git -C "/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask" 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-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!

対処法

自分の場合は、記述されている通り以下を実行すると解決しました。

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

エラーの原因

このエラーは、HomebrewのTapリポジトリが「shallow clone(浅いクローン)」になっている場合に発生します。

Error: homebrew-cask is a shallow clone.
To `brew update` first run:

2020年12月頃のHomebrewの仕様変更により、GitHubからの要請を受けてshallow cloneのまま更新することができなくなりました。

エラーメッセージに表示されたコマンドを実行する

まずは、表示されたコマンドをそのまま実行します。

git -C "$(brew --repo homebrew/cask)" fetch --unshallow

処理には数分かかる場合があります。

homebrew-coreでも同様のエラーが発生する場合

homebrew-coreでも同様のエラーが表示される場合は、以下を実行します。

git -C "$(brew --repo homebrew/core)" fetch --unshallow

brew updateを再実行する

unshallow処理が完了したら、再度アップデートを実行します。

brew update

Apple SiliconとIntel Macの違い

Homebrewのインストール先はMacのCPUによって異なります。

  • Intel Mac:/usr/local
  • Apple Silicon(M1/M2/M3):/opt/homebrew

$(brew --repo)を利用することで、環境を意識せず実行できます。

それでも解決しない場合

Tapの状態が壊れている場合は、一度Tapを削除して再追加することで解決することがあります。

brew untap homebrew/cask
brew tap homebrew/cask

参考リンク