5

So I just installed the latest git, with the official mac installer. I'm on Mavericks.

Sadly, git --version is still

git version 1.9.3 (Apple Git-50)

and which git gives me:

/usr/bin/git

Instead, the git installer installed the updated git in

/urs/local/git

echoing $PATH gives:

[some hidden paths]:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/git/bin/:/usr/local/bin

How can I make my mac to use the right update git?

3
  • 1
    Change the order of your $PATH to search /usr/local/git/bin before /usr/bin. Commented Jan 26, 2015 at 17:24
  • Ok, but how (I'm not such an expert): for what I can see, $PATH is the union of several files, it's not stored on a single file. I think, among others, /etc/paths and /etc/paths.d/git (this last containing /usr/local/git/sbin ) Commented Jan 27, 2015 at 8:07
  • Ok, in /etc/paths I had /usr/bin /bin /usr/sbin /sbin /usr/local/bin and I added /usr/local/git/bin before all. Now it works. Thank you. Commented Jan 27, 2015 at 8:12

2 Answers 2

4

If you don't need the older version of git in /usr/bin/git, the quickest and easiest thing to do is to rename the old binary in /usr/bin/git to something like git.v1.9.3 and symlink the new version.

First rename:

mv /usr/bin/git /usr/bin/git.v1.9.3

Next symlink new:

ln -s /usr/local/git /usr/bin/git

Now check the binary:

git --version
1
0

The following worked for me

brew link --overwrite git

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.