Install Git on macOS
Section 1: Checking your version of Git
Open a new Terminal to type and run the following command to see if you already have Git installed. This will also check the installed version:
git --version
If you see a Git version (for example,
git version 2.x.x), Git is already installed. If you get an error and Git is not recognized, follow Section 2 to install it.
Section 2: Using Homebrew to install Git (recommended)
There are several options for installing Git on macOS. In this guide we recommend using Homebrew — it is widely used, easy to update, and works well for development workflows.
Install Homebrew if you don’t already have it. Visit https://brew.sh/ for the latest installation instructions, or run this command in your Terminal:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"See our Homebrew guide: /docs/tools/homebrew/
Update Homebrew and install Git:
brew update brew install gitRe-run Section 1 (
git --version) to verify Git installed successfully.
Alternative: Download Git installer directly
If you prefer not to use Homebrew, you can explore other installation methods:
Visit the official Git download page: https://git-scm.com/download/mac
- Review the available installation options listed on that page. The site provides several methods including:
- Binary installers (when available)
- Package managers like MacPorts
- Building from source
Choose the method that works best for your system and follow the instructions provided on the Git website.
- After installation, open Terminal and verify by running
git --version.
Note: Xcode Command Line Tools — running git in Terminal on a Mac without Homebrew or Git installed may trigger a prompt to install Apple’s developer tools, which also includes Git. You can accept that prompt as an alternative installation method.
Section 3: First-time Git setup
Set your name and email (these appear in commits):
git config --global user.name "Your Name"
git config --global user.email "you@example.com"
Replace the values with your GitHub username and the email you used to register.