gitmacospathhomebrew

brew doctor Warning: How to add git to PATH?


I installed Homebrew on OS X El Capitan. In the last steps of the installation I was supposed to install git with

brew install git

which was fine. Now if I run 'brew doctor' this happens:

$ 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: 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

If I run 'brew install git' again, I get:

$ brew install git 
Warning: git-2.7.4 already installed

So needless to say my git version is 2.7.4. 'brew update' throws:

$ brew update
Warning: git-2.7.4 already installed
Error: Git must be installed and in your PATH!

Question: How do I fix my PATH so git can be found in my PATH and 'brew doctor' results in 'Your system is ready to brew'?


Additional Information:

EDIT: Added cask to additional information.

EDIT2: Added brew config and added brew doctor prefix


Solution

  • First, change directory to /usr/local/Homebrew in the Terminal (for older versions of MacOS, use cd /usr/local/Library/Homebrew). Then run this:

    git pull origin master
    brew update && brew upgrade