orome
orome

Reputation: 48436

Can't update or upgrade 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

Upvotes: 55

Views: 41796

Answers (5)

Angelo Igitego
Angelo Igitego

Reputation: 93

brew update was not working (was hanging forever). I uninstalled and reinstalled. Still not working. I tried all of the possible solutions in vain. Then, I changed my internet network from the office's wifi to my phone's hotspot. The problem was fixed.

Upvotes: 0

Fernando Martínez
Fernando Martínez

Reputation: 1077

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

Note: For ARM-based Macs, Homebrew Taps are now: /opt/homebrew/Library/Taps/homebrew

Upvotes: 60

Sammie Kiogora
Sammie Kiogora

Reputation: 1

This worked for me.

git -C "/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core" fetch --unshallow
git -C "/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask" fetch --unshallow
remote: Enumerating objects: 561296, done.
remote: Counting objects: 100% (561255/561255), done.
remote: Compressing objects: 100% (200847/200847), done.
remote: Total 552295 (delta 355423), reused 545449 (delta 348597), pack-reused 0
Receiving objects: 100% (552295/552295), 214.42 MiB | 2.60 MiB/s, done.
Resolving deltas: 100% (355423/355423), completed with 4915 local objects.
From https://github.com/Homebrew/homebrew-core
   09e19b5c825..003302f81db master     -> origin/master
remote: Enumerating objects: 180904, done.
remote: Counting objects: 100% (166460/166460), done.
remote: Compressing objects: 100% (47394/47394), done.
remote: Total 155334 (delta 116608), reused 146431 (delta 107784), pack-reused 0
Receiving objects: 100% (155334/155334), 73.84 MiB | 4.87 MiB/s, done.
Resolving deltas: 100% (116608/116608), completed with 6054 local objects.
From https://github.com/Homebrew/homebrew-cask

Upvotes: 0

lpuerto
lpuerto

Reputation: 420

Seems that is has been a change in the Homebrew policy and there is not going to be a shallow clone any more.

The correct answer is unshallow, as requested —see Eric3 answer— or install it again, which is going to produce a unshallow / regular copy of the repo.

Upvotes: 3

Eric3
Eric3

Reputation: 1021

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

Upvotes: 72

Related Questions