brew update fails with this error:
$ brew update
Warning: git-2.9.0 already installed
Error: Git must be installed and in your PATH!
Detailed infos follows. Thanks for any help!
$ brew config
HOMEBREW_VERSION: 0.9.9
ORIGIN: https://github.com/Homebrew/brew.git
HEAD: a02be9eea204264ce48827ac365c8b53b986d66a
Last commit: 24 minutes ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 09a63d8488509fcb92b3068d79d50d708f0fefdd
Core tap last commit: 2 weeks ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_REPOSITORY: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
HOMEBREW_BOTTLE_DOMAIN: https://homebrew.bintray.com
CPU: octa-core 64-bit haswell
Homebrew Ruby: 2.0.0-p648
Clang: 7.3 build 703
Git: 2.9.0 => /usr/local/bin/git
Perl: /usr/bin/perl
Python: /usr/bin/python
Ruby: /Users/stefanscheidt/.rbenv/shims/ruby => /Users/stefanscheidt/.rbenv/versions/2.0.0-p648/bin/ruby
Java: 1.8.0_92
OS X: 10.11.5-x86_64
Xcode: 7.3.1
CLT: N/A
X11: N/A
$ 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 and just ignore them. Thanks!
Warning: You have unlinked kegs in your Cellar
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
ansible
ansible19
$ brew update
Warning: git-2.9.0 already installed
Error: Git must be installed and in your PATH!
stefanscheidt@digital0379: ~
$ brew update
Warning: git-2.9.0 already installed
Error: Git must be installed and in your PATH!
$ which -a git
/usr/local/bin/git
/usr/local/bin/git
/usr/bin/git
$ echo $PATH
/Users/stefanscheidt/.sdkman/candidates/maven/current/bin:/Users/stefanscheidt/.sdkman/candidates/ant/current/bin:/Users/stefanscheidt/.rbenv/shims:/Users/stefanscheidt/.nvm/versions/node/v4.3.2/bin:.:/Users/stefanscheidt/.local/bin:/Users/stefanscheidt/local/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/MacGPG2/bin
As of about 30 minutes ago I'm having the exact same problem...
You may need to:
cd $(brew --prefix) && git fetch && git reset --hard origin/master
To escape the error. Should only need doing once if brew update remains stuck.
@DomT4 Don't think that's necessary any more but folks: if it is, please let me know.
It seems to be, based on checking locally & our CI output. If you ended up there, can't seem to brew update successfully.
For me, brew update seems to work fine again!
Thanks for the super fast fix!
I had to switch to master to get it work again, and still getting the weird message:
Warning: git 2.15.1 is already installed
Error: Git must be installed and in your PATH!
@hannesN What's your brew doctor and brew config output?
I had the same issues as above, my brew doctor output looked like
```Warning: Git could not be found in your PATH.
Homebrew uses Git for several internal functions, and some formulae use Git
checkouts instead of stable tarballs. You may want to install Git:
brew install git
Warning: No developer tools installed.
Install the Command Line Tools:
xcode-select --install
Warning: Homebrew's sbin was not found in your PATH but you have installed
formulae that put executables in /usr/local/sbin.
Consider setting the PATH for example like so
echo 'export PATH="/usr/local/sbin:$PATH"' >> ~/.bash_profile
```
I ran xcode-select --install and made sure i had /usr/local/sbin in my path and now brew's working great again.
Btw, it was working fine yesterday, I think installing macOS High Sierra last night is what tripped it up.
What happens if you manually run git after the update to High Sierra? Does it throw out anything interesting?
The above solution (xcode-select --install) fixed my issue, so I deleted my previous comment.
I do remember that running git would print an error message right after the upgrade to High Sierra, but unfortunately I cannot remember the exact error. But I managed to fix it then (again I can't remember how exactly :(
I had this problem this morning, and after reading the comments here I figured it could be related to me having moved Xcode.app to the trash a few days ago. I tried some of the commands suggested here, namely xcode-select --install but nothing worked. Here's a detailed walkthrough of what I did, although I think the last step alone might fix this issue for you.
Removed all Xcode.app-related leftovers, according to the commands listed in the top answer to this question (and the top comment to that answer, as well).
I ran sudo rm -rf /Library/Developer/CommandLineTools which deleted my standalone version of the command line tools. You might not have this, so this command might return "No such file or directory". This is fine.
I (re)installed the standalone command line tools with xcode-select --install. This still didn't fix Homebrew finding git for me, so I then read the man page for xcode-select and I did...
sudo xcode-select -r. This should make your brew doctor output "ready to brew".
You might also need to update the newly installed command line tools with the App Store; a new update should show up in the "Updates" section.
I just ran into the same problem. The following two commands fixed the issue for me:
sudo xcode-select -r
xcode-select --install
Most helpful comment
The above solution (
xcode-select --install) fixed my issue, so I deleted my previous comment.I do remember that running
gitwould print an error message right after the upgrade to High Sierra, but unfortunately I cannot remember the exact error. But I managed to fix it then (again I can't remember how exactly :(