1

I have installed the Apple Developer Tools 5 on Mac OS X 10.9.4 which comes with Git:

git version 1.8.5.2 (Apple Git-48)

I also have installed Git 2.0.1 using the Mac OS X installer. How do I best set it up so that all applications use Git 2.0.1 by default? I could exchange the Apple Git binary for a symlink to the custom one. Alternatively I would have to modify the PATH so that it looks up the custom Git first. Is there any reason to prefer one over the other?

Also, is that even a safe thing to do? Would anything, for instance XCode, break if I replaced Apple Git with Git 2.0.1?

2

I've talked about modifying system tools before and the short of it is: don't do it! Things will use the system tools expecting a certain version of a certain tool and if you change that you could break many things.

Instead, change your path. For example, if your git is located at /usr/local/git/bin/git, add the following to your ~/.bash_profile or equivalent:

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

This way, you can use your git by running git but the system git will remain available.

  • That's what I thought, and I already went with the solution you suggest. Thanks! – Björn Pollex Jul 30 '14 at 19:22
  • Extra hint... create an link to your custom git called "git2" somewhere on your path. Then you can use $ git or $ git2 interchangeably – sdmeyers Jul 30 '14 at 20:10
  • Also, use something like Homebrew for installing Git and similar tools. It will install them in /usr/local/ by default, making it easy to switch between versions. – nwinkler Jul 31 '14 at 7:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .