Brew Update not working after mac 10.9
HomebrewHomebrew Problem Overview
First time running brew since 10.9 upgrade.
From the output below, should I just remove Library/Formula/ant.rb and Library/Formula/apple-gcc42.rb? Also, unclear why git pull is failing. Thanks for any help
525 [projects]$ brew --config
HOMEBREW_VERSION: 0.9.4
ORIGIN: https://github.com/mxcl/homebrew.git
HEAD: 27c26faf7b958de6028ad55be8ccc5a57b094d3f
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
CPU: 8-core 64-bit ivybridge
OS X: 10.9-x86_64
Xcode: 5.0.2
GCC-4.2: build 5666
LLVM-GCC: build 0
Clang: 5.0 build 500
X11: N/A
System Ruby: 1.8.7-358
Perl: /usr/bin/perl
Python: /usr/bin/python
Ruby: /Users/*****/.rvm/rubies/ruby-2.0.0-p195/bin/ruby
526 [projects]$ brew update
error: The following untracked working tree files would be overwritten by merge:
Library/Formula/ant.rb
Library/Formula/apple-gcc42.rb
Please move or remove them before you can merge.
Aborting
Error: Failure while executing: git pull -q origin refs/heads/master:refs/remotes/origin/master
Homebrew Solutions
Solution 1 - Homebrew
This fixed it for me
cd `brew --prefix`/Homebrew
git fetch origin
git reset --hard origin/master
brew update worked fine after that
Solution 2 - Homebrew
Solution
>You might still find..
>brew update not working after git pull origin master
Here what you need to do.
git pull origin master
brew install git
Now you might already have git on your System, but what this will do it that now.
Your broken brew update will automatically be updated before at first run..
Here is the link to the origin issue in HomeBrew. brew stuck
Solution 3 - Homebrew
My brew update was hanging and doing nothing. I am on OSX 10.12.5 and none of the above worked for me and I have no .git in usr/local
, only in usr/local/Homebrew
.
I ran brew update --debug --verbose
and brew update
and that fixed the issue, see this issue: https://github.com/Homebrew/brew/issues/895
Solution 4 - Homebrew
I simply removed the .git
directory inside of the /usr/local
directory, then ran the command brew update
.
Solution 5 - Homebrew
I did this to solve the problem
cd /usr/local
git pull origin master
Solution 6 - Homebrew
What worked for me was to update the brew like this:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Solution 7 - Homebrew
On Big Sur 11.1 fixed it for me:
git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow
Brew self described it as:
> 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!
Solution 8 - Homebrew
What worked for me on Big Sur 11.4 was first following Pritam comment by executing the following command:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
And then executing the following (what MoD said but with addition):
git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow && git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask fetch --unshallow
It took a while for both commands to finish, don't worry it's not you.... just let them run
Solution 9 - Homebrew
I have tried all solutions posted here but nothing had worked. I have found solution to fix the problems retated to Homebrew and that is "brew doctor". This command option diagnose the problem and suggest the solution. For my case, the command showed following comment.
I guess this command would solve many problems related to home brew so try it out!
❯ brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!
Warning: A newer Command Line Tools release is available.
Update them from Software Update in System Preferences or run:
softwareupdate --all --install --force
If that doesn't show you any updates, run:
sudo rm -rf /Library/Developer/CommandLineTools
sudo xcode-select --install
Alternatively, manually download them from:
https://developer.apple.com/download/all/.
You should download the Command Line Tools for Xcode 13.1.