# How to install Git on macOS

> Learn how to install Git on macOS using Homebrew or the official installer, verify it with git --version, and set up your name and email identity.

Author: [Flavio Copes](https://flaviocopes.com/about/) | Published: 2024-08-20 | Topics: [Git](https://flaviocopes.com/tags/git/) | Canonical: https://flaviocopes.com/how-to-install-git-on-macos/

In this post I’ll walk you through the process of installing [Git](https://flaviocopes.com/git/) on macOS. It's a straightforward process that will have you up and running with version control in no time.

There are two main methods to install Git on macOS: using Homebrew or downloading the installer from the official Git website. We'll cover both approaches.

Let's start with Homebrew. It's a popular package manager for macOS. If you don't have Homebrew installed, you can install it by running this command in your Terminal:

```bash
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
```

Once Homebrew is installed, you can easily install Git by running:

```bash
brew install git
```

If you prefer using the official installer, here's what you need to do: First, visit the official Git website at [https://git-scm.com/download/mac](https://git-scm.com/download/mac). Download the latest version for macOS, open the downloaded .dmg file, and run the installer, following the prompts.

After installation, it's important to verify that Git was installed correctly. Open a new Terminal window and run:

```bash
git --version
```

This should display the installed Git version, confirming a successful installation.

![Terminal window showing git --version command output displaying git version 2.39.3 Apple Git-146](https://flaviocopes.com/images/how-to-install-git-on-macos/1.webp)

Now, let's set up your Git identity. Run these commands, replacing the placeholder information with your own:

```bash
git config --global user.name "Your Name"
git config --global user.email "youremail@example.com"
```

To keep Git up to date, you can use Homebrew (if that's how you installed it) by running:

```bash
brew upgrade git
```

If you used the installer, you'll need to download and run the latest version from the Git website when updates are available.

That's it! You now have Git installed and configured on your macOS system.

> Want to actually learn Git? Want to stop feeling frustrated with it? I created the [Git Masterclass](https://git.flaviocopes.com/) to solve this problem!
