Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I am following the Lynda.com Git Essential Training. After he downloads and installs Git he enters which git and gets /usr/local/git/bin/git However when I do it I still get the preinstalled path /usr/bin/git

How do I change the path so I am working with my downloaded version of Git

I am using a Macbook Air - Mavericks - OS X 10.9.4 and followed the default install instructions.

share|improve this question
    
There is also a Mac specific way to set paths: apple.stackexchange.com/questions/106355/… –  bdecaf Jul 14 at 12:15

2 Answers 2

up vote 6 down vote accepted

Add the following to your ~/.bash_profile

export PATH=/usr/local/git/bin:$PATH
share|improve this answer
    
I get the following after running which git /usr/local/git/bin//git Is the double forward slash ok? –  Pierce McGeough Jul 14 at 12:29
1  
@Pierce Oops, left a trailing slash—fixed –  grgarside Jul 14 at 12:30

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.