Why is Git not found after installing OS X Lion?

Lion (and Snow Leopard) didn't ship with git - so perhaps the way you installed git didn't survive the upgrade. You'll need to find your copy of git or just get a new copy. Using spotlight to search your Time Machine backups might be fruitful to find the files and know if it's a path issue or the binaries are truly gone after Lion migrated your data.

All of your repos stored in user space are fine. Do try to get the same or newer version of git.

The command line mdfind -name git will list all files that spotlight has seen with git in the name. Most installations of git should survive an upgrade to Lion and you only have to clean up your environment or link to the binary from somewhere in your $PATH.

Xcode 4(4.0-4.2) drops git into /Developer/usr/bin along with most of the other tools you need like make and gcc. It might be simplest to maintain git after getting the (currently) free Xcode from the App Store. Xcode 4.3 puts giy and other tools in Applications/Xcode.app/Contents/Developer/usr/bin.

To avoid issues with different versions, you might want to make sure any old versions are gone from your hard drive. (and certainly from your $PATH)


If /usr/local/git already exists, you'll need to either add it to your $PATH or make a symlink placing the symlink inside a directory that is in your existing PATH.

A common practice is to make /usr/local/bin if it doesn't exist and add a link:

sudo -s
mkdir -p /usr/local/bin
ln -s /usr/local/git/bin/git /usr/local/bin/git
exit

If you have XCode installed, the best solution is Xcode -> Preferences -> Downloads -> Install Command Line Tools.

This put git (among other things) at /usr/bin/git.

If you don't have Xcode installed, then installing it just for git would definitely be overkill.


I think you will find that Git is still installed on your system. It looks like the PATH is just messed up. Check to see if /usr/local/git still exists on your system.

I just added the following to my ~/.bashrc file and everything is back to normal.

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

To be more specific, this site - http://www.joshstaiger.org/archives/2005/07/bash_profile_vs.html - details the difference between .bashrc and .bash_profile. If you use Mac's terminal with Git, then adding the above PATH specification to your .bash_profile will do the job. Of course, you'll have to close the Terminal window and open a new one because the .bash_profile file is loaded on a Terminal window's opening.

In summary, adding this to .bash_profile would work too.


Step 1: Reinstall git (I just installed the Snow Leopard version from here) if it's not in:

/usr/local

Step 2: Open Terminal and do the following:

cd /etc

sudo nano bashrc

Then in nano at the top of the file write (as aaron suggested)

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

Press Ctrl+X to quit nano and press Y to save. Then exit terminal and reopen and git should be working for you.