Brew doctor Warning: how to add git to PATH?

I installed Homebrew on OS X El Capitan. In the last stages of the installation, I had to install git with

brew install git 

which was good. Now, if I run "brew doctor", this will happen:

 $ 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, of course, my version of git 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 to fix my PATH, so git can be found in my PATH and brew doctor results: "Is your system ready for brew '?


Additional Information:

  • which -a git results in:

     $ which -a git /usr/local/bin/git /usr/local/bin/git /usr/bin/git 
  • I tried many potential fixes, meanwhile I did:

     echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.bash_profile 

    My ~ / .bash_profile now looks like this:

     # Setting PATH for Python 2.7 # The orginal version is saved in .bash_profile.pysave PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}" export PATH=/usr/local/bin:$PATH 
  • When I try to install boxing:

     $ brew tap caskroom/cask ==> Installing git Warning: git-2.7.4 already installed Error: Git is unavailable 
  • brew config:

     $ brew config HOMEBREW_VERSION: 0.9.5 ORIGIN: (none) HEAD: (none) Last commit: never 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 OS X: 10.11.4-x86_64 Xcode: 7.3 CLT: 7.3.0.0.1.1457485338 Clang: 7.3 build 703 X11: N/A System Ruby: 2.0.0-p648 Perl: /usr/bin/perl Python: /usr/local/bin/python => /usr/local/Cellar/python/2.7.11/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_40 

EDIT: added keg to additional info.

EDIT2: brew configuration added and brew physician prefix added

+11
git homebrew path macos
source share
7 answers

this fixed my problem:

 cd /usr/local/Library/Homebrew git pull origin master 

after that I ran again

 brew update && brew upgrade 
+28
source share

For me, this was due to the lack of xcode tools fixed with xcode-select --install .

Several other suggested fixes, including git fetch in the brew directory and / or modifying git core.autocrlf , did not fix this.

In more detail, I removed git from brew brew uninstall --force git , but my own Apple git then did not work ( /usr/bin/git --version reported missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun ).

Running brew doctor suggested launching xcode-select --install , I ran this and fixed Apple git, and also fixed brew. (Maybe then reinstall git via brew brew install git .)

+10
source share

Just run:

 export PATH=/usr/local/bin:$PATH 

Your PATH variable should look something like this:

 PATH="/usr/bin:/usr/local/bin" 
+1
source share

I found a solution to my problem. This was caused by the incorrect file format /usr/local/Library/ENV/scm/git :

 $ /usr/local/Library/ENV/scm/git --version -bash: /usr/local/Library/ENV/scm/git: /bin/sh^M: bad interpreter: No such file or directory 

So, I edited fileformat:

 $ vi /usr/local/Library/ENV/scm/git 

Press "ESC", write :set fileformat=unix , press 'Enter', write :wq! .

This fixed it for me.

+1
source share

I encountered the same symptom when tyring ran brew update .

In my case, the problem was caused by the presence of the bash variable from GIT (to the directory). So the solution was to disable it for the brew command

 $ GIT= brew update 
0
source share

If you look like me: using macOS El Capitan and don't have /usr/local/Library/ENV/scm/git , here is what you can do.

 cd /usr/local/ # The folder where you've installed Homebrew git config --list --local 

Look for: core.autoxrlf=false

If you do not see it starting: git config --local core.autocrlf false

Then run:

 git fetch origin git reset --hard origin/master brew update 
0
source share

The probable problem with libintl.8.dylib, as in many other similar problems:

 locate libintl.8.dylib 

if /gettext//libintl.*.dylib exists

 brew link -f gettext 

go to (depending on version)

 cd /usr/local/Homebrew cd /usr/local/Library/Homebrew 

and execute (make sure you are in the directory ... / Homebrew)

 git pull origin master rm -fr ".git/rebase-apply" brew update && brew upgrade 

this last will took some time, but then everything should work fine.

0
source share

All Articles