11

I installed the GitHub UI for OS X from here: https://central.github.com/mac/latest. As part of the installation I get an option to "Install Command Line Tools". On doing so it places the relevant assets under /usr/local/bin. I assumed it would register git in the PATH variable as well so that I could run it from the terminal if needed. However it doesn't work from the terminal, instead if I run 'git' in terminal, I get prompted to install XCode.

Am I assuming something incorrectly here? Also tried installing git from here: http://git-scm.com/download/mac. After the installer completed successfully, I still can't seem to be able to use git from the terminal.

UPDATE: my PATH variable has the following:

/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin

4
  • First, you need to restart bash (e.g. by opening a new terminal) after installing something that modifies the default values of environment variables. Second, what does echo $PATH say? Commented Nov 10, 2013 at 8:14
  • /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin Commented Nov 11, 2013 at 9:29
  • Whenever I try and invoke git from the terminal I get the following message with a prompt: xcode-select: note: no developer tools were found at '/Applications/Xcode.app', requesting install. Choose an option in the dialog to download the command line developer tools. Commented Nov 11, 2013 at 9:31
  • Any chance you can try and put /usr/local/git/bin first in the PATH? (just in one shell session, to see how XCode and git react then)
    – VonC
    Commented Nov 11, 2013 at 10:32

3 Answers 3

12

As mentioned in "git on Mac: replace Apple XCode CLI git with symbolic link to latest git install?", it dpeends on the order of the folders in the PATH environment variable.

  • XCode CLI installer puts a copy of git in /usr/bin
  • Reinstalling the latest git from git-scm.com put git in /usr/local/git/bin/git

If git command line is installed in /usr/local/git/bin, make sure to put that in first:

PATH=/usr/local/git/bin:$PATH
2

Just download these tools running command in terminal:

xcode-select --install

If it doesn't help you try to download them manually form apple developer site: https://developer.apple.com/downloads/index.action?=command%20line%20tools#

It helped me.

1
0

This command worked for me

sudo xcode-select -switch /Library/Developer/CommandLineTools

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.