# How to install Git on macOS

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 Git release.
    
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 to get the latest stable version.
    
4.  Use MacPorts to install the latest stable version of Git.
    
5.  Get the tarball from [kernel.org](https://mirrors.edge.kernel.org/pub/software/scm/git/), compile it, 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 is 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 like 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 contributing to Git. Both options also require installing 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 as 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.
    

```shell
$ git
```

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

%[https://youtu.be/PUWHGnP15GU] 

## 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.

```shell
$ which git
```

The Apple-provided installation returns:

```shell
/usr/bin/git
```

A user-installed version most likely returns:

```shell
/usr/local/git
```

You can check the version of Git by typing:

```shell
$ git --version
```

The response should look something like the following:

```shell
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, as shown in the response above.
