MacOS – Installing git on OSX 10.8 without Xcode

gitmacosxcode

I'd like to setup my dev environment on my girlfriend's iMac, but she's not cool with me wasting 3GB of space, which is what Xcode takes up. She also doesn't want to/can't upgrade past 10.8 because then Photoshop won't work, or some nonsense.

How can I get git on OSX 10.8 without Xcode. I somehow doubt that it's impossible to run a few megabytes of git without 3GB of Xcode.

Best Answer

Note that this is a plain copy of a previous answer of mine on superuser.com.

Here's a way to install git on Mac OS X without XCode.

Git's official web site provides an installer : http://git-scm.com/download/mac

After installing git, you also have to add its directory to your path : echo "PATH=/usr/local/git/bin:\$PATH" >> ~/.bash_profile source ~/.bash_profile

Adding the directory to the path will prevent Mac OS X from aksing you to install XCode each time you type git in the terminal.

Credits goes to Bobby Allen and to GoZoner's answer on SO.