How to install Git on Mac: a step-by-step guide

There are some tools that many of us use on our Macs that don’t need anything more than a click on an App Store page to install them. And there are others that take much more effort and sometimes feel like they need a degree in software engineering to install. Git doesn’t quite fall into the latter category, but it’s definitely not a one-click process. So, in this article, we’ll show you how to install Git on Mac, and we have prepared 4 different ways in which it can be done.

What is Git?

Chances are that if you want to install Git on your Mac, you know exactly what it is and why you want it. But, just in case, here’s a recap.

Git is a version control system for software development. It allows programmers to make changes to code, knowing that if something goes wrong, they can roll back to a previous version of the code, and all will be well again. Git allows programmers to collaborate and organize large projects with huge codebases while minimizing the risks of catastrophic errors. Using Git also allows developers to host and share code on GitHub.

Tip: How to improve your privacy when you’re using your Mac

Whenever you use your Mac and whatever you do with it, you leave traces of activity behind. That could be your browser history, files websites placed on your Mac, your Recent Items list, or public Wi-Fi networks your Mac saved so that it could access them easily next time. In addition to that, the applications you use on your Mac can, with your permission, access your camera, microphone, and folders like Desktop and Documents. They can also, if you allow them, record your screen. It’s very important that you are aware of what is being saved on your Mac that could compromise your privacy if it is seen by someone else. And it’s equally important to manage the permissions you grant to applications. Doing all that manually is time-consuming and difficult. However, there is a tool that can help you do all of that easily. CleanMyMac X’s Privacy module scans your Mac looking for data that could compromise your privacy and gathering information on applications that have permission to access sensitive parts of your Mac. You can then remove those files or revoke permissions with a couple of clicks. You can download CleanMyMac X here for free and try it for yourself.

CleanMyMac X - Safari in Privacy module


Doesn’t macOS come with Git?

macOS doesn’t have a built-in version of Git. However, if you install Apple’s development environment — Xcode — you can install the Command Line tools from that, which will install Git. The reason for this seems to be that the Command Line tools are updated when Xcode is updated, and this means that Git will also be updated.

How to check which version of Git you already have

Before you install Git from scratch, it’s worth checking which version, if any, is already installed on your Mac:

  1. Go to Applications > Utilities and open Terminal.
  2. Type git --version
  3. Press Return.
  4. You’ll see a message on the screen telling you which version, if any, of Git is installed.

How to install Git on Mac

As mentioned, there are different ways to install Git on Mac, and we’ll show you them all below.

Xcode

  1. Install Xcode from the App Store.
  2. Once Xcode has installed, open Terminal from Applications > Utilities.
  3. Type xcode-select --install and press Return.
  4. That command installs Command Line tools and, with them, Git.
  5. To check Git is installed properly, when Command Line has installed, type git --version and press Return.

Homebrew

If you don’t want to install Xcode, you can install Git on your Mac using Homebrew. Here’s how to do it using Terminal. Before you install Git, however, you’ll need to install Homebrew if it’s not already installed. Here’s how:

  1. In Terminal, paste the following command and press Return: /bin/bash -c “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)”
  2. Type in your admin password.
  3. Now you can install Git using the command below: brew install git
  4. You can check that it installed correctly using this command:
    git --version

If you get a result that shows the version of Git you were trying to install, the installation has completed successfully.

GitHub

If you’re planning on using GitHub, the simplest way to install Git on Mac is to install GitHub Desktop. When you install GitHub Desktop, Git is installed automatically. You can download GitHub Desktop here. Now, follow these steps:

  1. Click the link above and choose Download for macOS.
  2. When GitHub Desktop has downloaded, it should unzip itself automatically. If not, double-click it to unzip it.
  3. Drag the GitHub Desktop file to your Applications folder.

Standalone installer

If you don’t want to install GitHub desktop or use Terminal to install Git, there is a standalone installer you can use. However, it hasn’t been updated since 2021 and may not work well with versions of macOS released since then. There have also been reports of compatibility issues with older versions of macOS. So, it’s probably best to only use this method if you don’t want to use Homebrew or install Xcode or GitHub Desktop on your Mac.

  1. You can download the standalone installer here.
  2. Click Download and wait for the download to finish.
  3. Double-click the DMG file to mount the disk image.
  4. Navigate to the disk image and double-click the installer.
  5. Follow the instructions on the screen to complete the installation.

If you’re working on a software development project that needs Git, there are a number of ways to install it on your Mac. If you have already installed Xcode, you should have Git installed. If not, you can use Homebrew, GitHub Desktop, or the standalone installer. Choose the method that suits you best and follow the steps above to install Git on your Mac.

Laptop with CleanMyMac
CleanMyMac X

Your Mac. As good as new.