I use Homebrew, then install git using Homebrew. This makes sure that git stays on my path, and makes it easy for me to keep git up-to-date, as well as making it easy to install other software, with its dependencies.
To install things with Homebrew, you first need to install the Xcode Command Line Tools. StackOverflow has a great answer on installing the command line tools on OSX 10.9.
After you have installed the Xcode Command Line Tools, you may notice that there is a git command you can use: see Does installing Command Line Tools for Xcode also install Git? That is not the Homebrew version of git, so it doesn't track updates.
Next, go to http://brew.sh and follow their directions for installing Homebrew. That will install git into the Homebrew directory, and link git to /usr/local/bin/git
. /usr/local/bin
should end up on your PATH before /usr/local/git
, so you will end up using the Homebrew version of git.
After that, you can install anything for which Homebrew has a formula, including the latest versions of git. Use brew update
to keep your index of available packages up to date, and brew doctor
to verify that your Homebrew configuration is correct. Then you can use brew upgrade git
to keep your git at the latest version available to Homebrew.