Error while updating Homebrew on my MacBook pro Big Sur

4.3k views Asked by At

Updating homebrew I received the following error:

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

2

There are 2 answers

0
Alexandre Franco On

Are you trying to install the Homebrew or run a brew update? In my case the former worked fine but the later I get the same error. While running git -C "/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core" fetch --unshallow I get the error: error: RPC failed; curl 18 transfer closed with outstanding read data remaining fatal: protocol error: bad pack header

Thanks, Alexandre

1
F1Linux On

I received same error as OP when updating homebrew. Here's how I resolved it:

Troubleshooting:

The "error" related to shallow-cloning is actually a change GitHub imposed on Homebrew:

"update.sh: refuse to update shallow homebrew-core/cask clones. #9383"

https://github.com/Homebrew/brew/pull/9383

So this "error" is being intentionally thrown to force users to stop using shallow clones- it's unrelated to any upgrade of OSX to "Big Sur" which was pushed out around the same time.

Resolution:

I just followed the guidance in the "error" message and brew update and brew upgrade worked:

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

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

NOTE: when I did my brew update/upgrade on my own Big Sur machine, I was using the latest version of Xcode- 12.3. Here's the output of brew config for comparative analysis if your brew update/upgrade is still failing:

HOMEBREW_VERSION: 2.7.1
ORIGIN: https://github.com/Homebrew/brew
HEAD: fdb71a5cb3029da2ef74d7e09c40575bbfb4ec72
Last commit: 9 days ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 9b85587e2fa7dc1e46f50572ecf1e951613d7e21
Core tap last commit: 29 minutes ago
Core tap branch: master
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CASK_OPTS: []
HOMEBREW_MAKE_JOBS: 12
Homebrew Ruby: 2.6.3 => 
/usr/local/Homebrew/Library/Homebrew/vendor/portable- ruby/2.6.3_2/bin/ruby
CPU: dodeca-core 64-bit kabylake
Clang: 12.0 build 1200
Git: 2.24.3 => /Applications/Xcode.app/Contents/Developer/usr/bin/git
Curl: 7.64.1 => /usr/bin/curl
macOS: 11.1-x86_64
CLT: 11.0.33.12
Xcode: 12.3