4

I have previously installed Git(1.9.3) and I want to upgrade it to the latest version(2.0.1). I uninstalled the previous install by running the uninstall.sh first and then git.pkg. However, when I run git --version, it still shows me git version 1.9.3 (Apple Git-50).

So I did this:

$ which git /usr/bin/git $ echo $PATH ...:/usr/local/git/bin 

Obviouslly, Git in /usr/local/git/bin is the latest version I want.

So how can I remove the path of the older version and tell Mac OSX where to find the right version?

Thanks!

3 Answers 3

11

One solution would simply to change the order in your $PATH in your ~/.bash_profile

export PATH=/usr/local/git/bin/:$PATH source ~/.bash_profile 

As suggested in git: command not found (on OS X 10.5) and Locate Git installation folder on Mac OS X.

In your case, you do have /usr/local/git/bin/ in your PATH, but in the wrong order if you want it to be taken into account.

Sign up to request clarification or add additional context in comments.

Comments

5

XCode uses its own git version, which makes it a bit difficult to update. These two terminal commands worked for me:

sudo mv /usr/bin/git /usr/bin/git-xcode sudo ln -sf /usr/local/git/bin/git /usr/bin/git 

This solution is taken from Heroku's recently published seurity alert for git 1.9.3. This post includes a download link. These two commands are advised in that link. The .dmg download package also includes a README file with a similar link.

1 Comment

For me just sudo mv /usr/bin/git /usr/bin/git-xcode did the trick. The other command which creates symbolic name is not needed
0

A preinstalled version of Git comes with OSX and I was using that after seeing that version has some major security issues I went ahead and downloaded the latest git from git site but even after installing, when I looked it up in the terminal with the command git --version it showed me the older one.

So I googled a bit and found out that

Those security vulnerabilities issues were addressed in the beta Xcode version as mentioned in this official statement from apple.

http://support.apple.com/en-us/HT204147

So guys go ahead and download the beta Xcode If you find it easy to use apples git like me.

Good Luck!

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.