Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't update or upgrade Homebrew

Tags:

homebrew

I can no longer run either brew upgrade or brew update: both abort with

Error: homebrew-core is a shallow clone. To `brew update` first run:   git -C "/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core" fetch --unshallow 

and if I follow this suggestion and run git ... --unshallow and then try brew update or brew upgrade I still get the same error message.

If I then try the command again (maybe I didn't do it right the first time?) I get

fatal: --unshallow on a complete repository does not make sense

How do I get past this error message to run brew upgrade or brew update without errors?


HOMEBREW_VERSION: 2.6.0-82-gde1afcb ORIGIN: https://github.com/Homebrew/brew.git HEAD: de1afcbfc58fb3cd5779bd8fbb6b9995700dda4c Last commit: 30 hours ago Core tap ORIGIN: https://github.com/Homebrew/homebrew-core Core tap HEAD: a7c63b0f7f7ae416a2f961b263155281759ac3a7 Core tap last commit: 29 hours ago Core tap branch: master HOMEBREW_PREFIX: /usr/local HOMEBREW_CASK_OPTS: [] HOMEBREW_DISPLAY: /private/tmp/com.apple.launchd.FwPJPzeLfq/org.macosforge.xquartz:0 HOMEBREW_EDITOR: /usr/local/bin/bbedit HOMEBREW_MAKE_JOBS: 4 HOMEBREW_NO_ANALYTICS: set HOMEBREW_NO_EMOJI: set Homebrew Ruby: 2.6.3 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby CPU: quad-core 64-bit haswell Clang: 12.0 build 1200 Git: 2.29.2 => /usr/local/bin/git Curl: 7.64.1 => /usr/bin/curl Java: 1.8.0_172 macOS: 10.15.7-x86_64 CLT: 12.0.32.27 Xcode: 12.2 XQuartz: 2.7.11 => /opt/X11 
like image 670
orome Avatar asked Dec 05 '20 18:12

orome


People also ask

What is the difference between brew update and brew upgrade?

brew update and upgradebrew update updates the above downloaded git repository with the latest code from GitHub. brew upgrade updates the actual packages to match the versions in the updated local git repository.


Video Answer


2 Answers

It's asking you to unshallow both homebrew-core and homebrew-cask with:

git -C "/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core" fetch --unshallow git -C "/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask" fetch --unshallow 
like image 90
Eric3 Avatar answered Oct 03 '22 00:10

Eric3


Nothing worked with me until I did:

cd /usr/local/Homebrew/Library/Taps/homebrew/ rm -rf homebrew-core git clone https://github.com/Homebrew/homebrew-core.git 
like image 29
Fernando Martínez Avatar answered Oct 03 '22 00:10

Fernando Martínez