How to install Git on macOS
In this post I’ll walk you through the process of installing 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:
/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:
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. 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:
git --version
This should display the installed Git version, confirming a successful installation.
Now, let’s set up your Git identity. Run these commands, replacing the placeholder information with your own:
git config --global user.name "Your Name"
git config --global user.email "[email protected]"
To keep Git up to date, you can use Homebrew (if that’s how you installed it) by running:
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 to solve this problem!
→ I wrote 17 books to help you become a better developer:
- C Handbook
- Command Line Handbook
- CSS Handbook
- Express Handbook
- Git Cheat Sheet
- Go Handbook
- HTML Handbook
- JS Handbook
- Laravel Handbook
- Next.js Handbook
- Node.js Handbook
- PHP Handbook
- Python Handbook
- React Handbook
- SQL Handbook
- Svelte Handbook
- Swift Handbook
Also, JOIN MY CODING BOOTCAMP, an amazing cohort course that will be a huge step up in your coding career - covering React, Next.js - next edition February 2025