top of page

How to install Git on macOS

Updated: Jul 3, 2022

There are several ways to install Git on macOS. To write this tutorial, I am using an iMac with macOS Catalina. On a fresh installation, macOS tells you that 'no developer tools were found requesting install.' If you already have XCode installed, you won't get this request. In that case, you probably already have an older version of Git installed.


There are six ways to install Git on macOS:

  1. Use the version that Apple ships with XCode, typically an older version of Git.

  2. Use the git-osx-installer from Tim Harper, a slightly newer version of Git, but not the latest.

  3. Use HomeBrew to install Git, allowing you to install the latest stable version of Git.

  4. Use MacPorts to install Git, allowing you to install the latest stable version of Git.

  5. Get the tarball from kernel.org and compile and manually install Git yourself.

  6. Get the source code from GitHub using an already installed version of Git. This will allow you to compile and install the bleeding edge version of Git.

Option (1) is the fastest way to get started and the scope of this tutorial.

Option (2) is not something I used because it also gets you a slightly older version of Git, and it looks to me this project has quite a few open issues.

Options (3) and (4) are probably the most common ways for developers to install the latest stable version of Git. I'll cover option 3 in a follow-up post. Stay tuned.

Options (5) and (6) allow you to manually compile the code of Git and perform a manual installation. These options are a bit more hardcore and unnecessary for most developers unless you are interested in studying the code or want to contribute to Git. Both options also require the installation of additional tools on your development system. Note that you can find Git on GitHub, but this project does not accept Pull Requests, unlike most open-source projects. Instead, you need to submit your contributions in the form of patches to the Git mailing list for review. The Git maintainer manually applies your patch if accepted.


How to install Git as shipped by Apple

  • Step 1 - Open the Terminal app.

  • Step 2 - Enter the following on the command line.

$ git

The video below shows what to expect for a fresh installation.


How to check your Git installation

You can figure out which installation of Git you have by finding its installation folder. You can do that using the which command in your Terminal.

$ which git

The Apple-provided installation returns:

/usr/bin/git

A user-installed version most likely returns:

/usr/local/git

You can check the version of Git by typing:

$ git --version

The response should look something like the following:

git version 2.24.3 (Apple Git-128)

If your version came with the XCode installation, it is most likely an older version of Git, just like the response shown above.


42 views0 comments

Comments


bottom of page