Apple - Where did /usr/bin/git come from?

git is installed by Xcode. I doubt you'll have any problems if you replace it, but I can't give you a definitive answer to that…

  1. What I'd do is rename the old /usr/bin/git to git_old, then rely on your path to select the new one.
  2. If that doesn't work, move the new one to /usr/bin. I doubt Xcode is picky about which version of git it's using.
  3. If that still doesn't work, move git_old back to /usr/bin/git and use either a direct path, rename, or alias for your new one.

I doubt you'll have to go past #1 above, though. That should be enough.

Edit: I read your original post backwards. The first thing you should do is make sure your path includes the new git directory BEFORE the directory that contains the old git.


You don't need to go hacking the other version out unless you are really tight for space. Edit your .bash_profile and make sure that /usr/local/bin occurs in front of /usr/bin in your PATH variable

Personally I prefer to adopt a scheme with tool paths defined and the path built from these e.g.

GIT_HOME=/usr/local

PATH=${GIT_HOME}/bin:${PATH};export PATH
MANPATH=${GIT_HOME}/share/man:${MANPATH};export MANPATH

This means that anything that searches for tools using the PATH will find your version of git, and anything that "really must" have the /usr/bin version will most likely have that path hard wired in and can still find it


I had the same problem: an old version of Git that was the Xcode version. I've tried to install a new version of Git from http://git-scm.com/ and updated the bash_profile with

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

Then reload your bash and try git --version

Worked for me :)

Tags:

Macos

Git