Homebrew – How to Fix Not Updating to Latest Commit

homebrew

I'm trying to update Homebrew on my Macbook Pro, but Homebrew says it is already up-to-date. However, I know this is not the case as I have another Homebrew install on another Mac, which is at a later Git commit.

The brew config on my Macbook Pro:

HOMEBREW_VERSION: 0.9.9
ORIGIN: https://github.com/Homebrew/brew.git
HEAD: 06fe347de97975dc01e726f87bf07a56a6fb713e
Last commit: 4 weeks ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: a05941384bcd8e4ef846237aba79d14dc47d757f
Core tap last commit: 4 weeks ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_REPOSITORY: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
HOMEBREW_BOTTLE_DOMAIN: https://homebrew.bintray.com
CPU: quad-core 64-bit haswell
Homebrew Ruby: 2.0.0-p648
Clang: 7.3 build 703
Git: 2.9.2 => /usr/local/bin/git
Perl: /usr/bin/perl
Python: /usr/local/bin/python => /usr/local/Cellar/python/2.7.12/Frameworks/Python.framework/Versions/2.7/bin/python2.7
Ruby: /usr/bin/ruby => /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
Java: 1.8.0_25, 1.7.0_67
OS X: 10.11.6-x86_64
Xcode: 7.3.1
CLT: 7.3.1.0.1.1461711523
X11: 2.7.7 => /opt/X11

And on my Mac:

HOMEBREW_VERSION: 0.9.9
ORIGIN: https://github.com/Homebrew/brew.git
HEAD: f64befdd783cbb01a05cd4d76a9f9f6d810d2eab
Last commit: 2 hours ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: ad4c80538a0f4c44ccc0e0681b890ec7578d19c4
Core tap last commit: 36 minutes ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_REPOSITORY: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
HOMEBREW_BOTTLE_DOMAIN: https://homebrew.bintray.com
CPU: quad-core 64-bit haswell
Homebrew Ruby: 2.0.0-p648
Clang: 7.3 build 703
Git: 2.10.0 => /usr/local/bin/git
Perl: /usr/bin/perl
Python: /usr/local/bin/python => /usr/local/Cellar/python/2.7.12/Frameworks/Python.framework/Versions/2.7/bin/python2.7
Ruby: /usr/local/bin/ruby => /usr/local/Cellar/ruby/2.3.1/bin/ruby
Java: 1.8.0_05
OS X: 10.11.6-x86_64
Xcode: 7.3.1
CLT: 7.3.1.0.1.1461711523
X11: 2.7.7 => /opt/X11

I know the Homebrew versions are the same. But the HEADs are quite different, and this means I can't brew upgrade to the latest versions of some packages (e.g. git, gcc).

Why is this happening, and how can I force Homebrew to update to the latest commit?

Best Answer

Resetting the Homebrew repository fixed this for me:

cd $(brew --repo) && git fetch && git reset --hard origin/master && brew update