Installing git on OSX 10.8 without Xcode

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.


Solution 1:

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.

Solution 2:

There is a binary installer that you can download. See also the Getting Started - Installing Git of the git website:

There are several ways to install Git on a Mac. The easiest is probably to install the Xcode Command Line Tools. On Mavericks (10.9) or above you can do this simply by trying to run git from the Terminal the very first time. If you don’t have it installed already, it will prompt you to install it.

If you want a more up to date version, you can also install it via a binary installer. An OSX Git installer is maintained and available for download at the Git website, at http://git-scm.com/download/mac.

However, as @denis points out, as of July 2017, the binaries on the download page of the Git website are for 10.9 or newer. If you look at where the binary files are actually hosted, on SourceForge, there is an a FAQ about which version of the binary installer to download if you have an older version of Mac OS X/macOS:

Which version should I download?

If you are running:

  • 10.6 Snow Leopard: git-*-snow-leopard
  • 10.7 Lion: git-*-snow-leopard
  • 10.8 Mountain Lion: git-*-snow-leopard
  • 10.9 Mavericks: git-*-mavericks
  • 10.10 Yosemite: git-*-mavericks
  • 10.11 Yosemite [sic]: git-*-mavericks

So for 10.8, you'll want to download any binary installer that ends with the name -snow-leopard. There are several such binary installers, but the one with the most recent version of Git is git-2.3.5-intel-universal-snow-leopard.dmg. Here is a direct download link for it (23.1 MB): https://sourceforge.net/projects/git-osx-installer/files/git-2.3.5-intel-universal-mavericks.dmg/download

Solution 3:

First of all you can download git directly, as Adam recommends.

As alternative to command line git tool you may want GUI app. I recommend Atlassian SourceTree. This is really nice and powerful Git/Mercurial client. I tried many GUI applications and only SourceTree satisfied me. Application package already has builtin Git and Mercurial.

At last, you may download Apple command line tools without XCode from Apple developer portal. If you are not developer yet, you should register in portal (it's easy and free).

Solution 4:

  1. Download and install GIT: http://git-scm.com/
  2. Add this to your .bash_profile file:

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

  3. Open a new terminal

Content based on this awesome tutorial:

http://blog.bobbyallen.me/2014/03/07/how-to-install-git-without-having-to-install-xcode-on-macosx/