0

How To fix 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 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 sens`e

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

Please Help me i was tired Thanks!

  • you mean, you run `git -C "/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core" fetch --unshallow`, and you still have the issue? – chenrui Jan 02 '21 at 22:29
  • Check this post: https://stackoverflow.com/questions/45782694/how-to-remove-the-shallow-clone-warning-from-homebrew – rs007 Jan 03 '21 at 00:26

1 Answers1

0

Basically if you see the following error then run what is suggesting you, but could take some time maybe between 5 and 10 minutes depending on how fast is your system:

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

I hope that answered your question to you or someone else, good luck.

darmis
  • 2,879
  • 1
  • 19
  • 21