homebrewアップデートがエラーでアップデートできない

環境構築

homebrewのアップデートは「brew update」でアップデートしていたましたが、以下のエラーでアップデートできませんでした。

アップデートのエラーメッセージ

$ brew update
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
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!

homebrewのバージョンを確認

$ brew --version
Homebrew 2.7.0
Homebrew/homebrew-core (git revision 5516a; last commit 2020-12-22)
Homebrew/homebrew-cask (git revision 4de271; last commit 2020-12-22)

エラーメッセージにある

git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch –unshallow
git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask fetch –unshallow
を実行するとアップデートできるようになるようです。

まず、1つ目。

$ git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow
(時間がかかるようです。数分待ちました)
remote: Enumerating objects: 557513, done.
remote: Counting objects: 100% (557483/557483), done.
remote: Compressing objects: 100% (202161/202161), done.
remote: Total 548341 (delta 355317), reused 536218 (delta 343345), pack-reused 0
Receiving objects: 100% (548341/548341), 183.48 MiB | 16.87 MiB/s, done.
Resolving deltas: 100% (355317/355317), completed with 8326 local objects.
From https://github.com/Homebrew/homebrew-core
   5516a9f3614..38a9de8aacc  master     -> origin/master

2つ目。

$ git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask fetch --unshallow
(こちらも時間がかかるようです。数分待ちました)
remote: Enumerating objects: 464565, done.
remote: Counting objects: 100% (464540/464540), done.
remote: Compressing objects: 100% (137587/137587), done.
remote: Total 457559 (delta 327865), reused 449020 (delta 319389), pack-reused 0
Receiving objects: 100% (457559/457559), 212.62 MiB | 12.17 MiB/s, done.
Resolving deltas: 100% (327865/327865), completed with 5397 local objects.
From https://github.com/Homebrew/homebrew-cask
   4de271fb54..46fce74c59  master     -> origin/master

結構時間がかかります。
アップデートそのものも時間がかかりました。。。

$ brew update
Updated 4 taps (heroku/brew, shopify/shopify, homebrew/core and homebrew/cask).
==> New Formulae
abricate                     dnsx                         keptn                        nuclei                       rpg-cli
・・・(略)たくさん表示されてました・・・
You have 21 outdated formulae installed.
You can upgrade them with brew upgrade
or list them with brew outdated.

homebrewのバージョン確認

$ brew --version
Homebrew 3.2.14
Homebrew/homebrew-core (git revision 38a9de8aacc; last commit 2021-10-05)
Homebrew/homebrew-cask (git revision 46fce74c59; last commit 2021-10-05)

バージョンアップできたようです。

コメント

タイトルとURLをコピーしました