LoginSignup
11
4

More than 3 years have passed since last update.

Homebrewでエラー homebrew-core is a shallow clone.

Last updated at Posted at 2021-02-05

リライト

こちらにリライトしました。

エラー内容

brew updatebrew tapをすると以下のようなエラーが出てしまいます。
homebrew-corehomebrew-caskが原因になってでエラーが出ています。

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!

解決策

解決策はエラー文中に出ているコマンドを実行することです。

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

原因

2020年12月以降にこのようなエラーが出ているようです。

HomebrewはこれまでGitリポジトリのshallow cloneを利用が、これからはcloneを利用して更新するように仕様変更になったからです。

なぜこのような仕様変更になったのかは、以下のディスカッションを参照してください。
Why is a full clone of homebrew/core required for brew update?

2020年12月4日の時点で該当がプルリクがマージされています。
update.sh: refuse to update shallow homebrew-core/cask clones.

11
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
11
4