Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Im following the tutorial below to install git.

However when I get to the end where I need to install the helper into the same directory where Git itself is installed i get the following error:

Davids-iMac:~ davidcavanagh$ which git
Davids-iMac:~ davidcavanagh$ sudo mv git-credential-osxkeychain /usr/bin
mv: rename git-credential-osxkeychain to /usr/bin/git-credential-osxkeychain: No such file     
or directory
Davids-iMac:~ davidcavanagh$ 

Edit: I am now getting the following error when I install git and then run git -version

Davids-iMac:~ davidcavanagh$ git -version
/usr/bin/git: line 1: syntax error near unexpected token `newline'
/usr/bin/git: line 1: `<?xml version="1.0" encoding="UTF-8"?>'
I was following this tutorial guide:

I have also tried using home-brew as well and I get the following error when I do this:

Davids-iMac:~ davidcavanagh$ ruby -e "$(curl -fsSkL"
==> This script will install:

Press ENTER to continue or any other key to abort
==> Downloading and Installing Homebrew...
Failed during: git init -q

Can anyone help? Thanks

share|improve this question

migrated from Nov 14 '12 at 14:27

This question came from our site for professional and enthusiast programmers.

You need to download the program, as it says in the guide a few lines above the code you are having a problem with.

git credential-osxkeychain # Test for the cred helper
# git: 'credential-osxkeychain' is not a git command. See 'git --help'.

curl -s -O # Download the helper

chmod u+x git-credential-osxkeychain # Fix the permissions on the file so it can be run
share|improve this answer
Thanks I did that but now im getting an error at the very end why I try and execute git config --global credential.helper osxkeychain Davids-iMac:~ davidcavanagh$ git config --global credential.helper osxkeychain /usr/bin/git: line 1: syntax error near unexpected token newline' /usr/bin/git: line 1: <?xml version="1.0" encoding="UTF-8"?>' Any ideas? – davemc Nov 14 '12 at 14:35
It seems you have downloaded something else, probably an error page. Download the file… and try again. – Joakim Nohlgård Nov 14 '12 at 14:45

On OSX use Homebrew to install git. Once you've installed homebrew with its simple one-liner command, then type these commands:

brew update
brew install git
share|improve this answer
When I try and use homebrew I get: Failed during: git init -q – davemc Nov 14 '12 at 14:46
up vote 0 down vote accepted

After trying everything I solved this problem by updating the Command Line Tools with Xcode. This can be done here: or by going to Xcode--->Preferences----->Downloads

share|improve this answer
  1. Download Git Installer – The download is titled “Snow Leopard,” but the package works fine with both Lion and Mountain Lion.

  2. Open Mac’s “System Preferences” and select “Security & Privacy”

  3. Under “Allow applications downloaded from,” make sure “Anywhere” is selected

  4. Open DMG downloaded in Step 1 and install the package.

  5. Open your terminal and run the following:

    sudo mkdir -p /usr/local/bin
    sudo ln -s /usr/local/git/bin/git /usr/local/bin/git
  6. Re-open your terminal and run the following:

    git –-version

    usage: git [--version] [--exec-path[=]] [--html-path] [--man-path] [--info-path] [-p|--paginate|--no-pager] [--no-replace-objects] [--bare] [--git-dir=] [--work-tree=] [--namespace=] [-c name=value] [--help] []

  7. You’re good to go...

share|improve this answer
Still getting that error after I have followed all those steps!Davids-iMac:~ davidcavanagh$ git -version /usr/bin/git: line 1: syntax error near unexpected token newline' /usr/bin/git: line 1: <?xml version="1.0" encoding="UTF-8"?>' – davemc Nov 14 '12 at 14:57

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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