Install Git on macOS
On macOS you have several good options. The right one depends on whether you already use Homebrew, want the very latest Git, or prefer the easiest possible path.
Check if Git is already installed
git --version
If macOS sees you typing git for the first time, it will pop up a dialog offering to install the Xcode Command Line Tools. Accepting that gives you Apple’s build of Git — perfectly usable, usually one or two versions behind upstream.
Option 1 — Homebrew (recommended)
Homebrew is the most popular macOS package manager. Installing Git through Homebrew gives you the latest version and makes updates trivial.
Install Homebrew (only if you don't have it)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Install Git
brew install git
Verify it picked up the Homebrew version:
which git # /opt/homebrew/bin/git (Apple Silicon) # /usr/local/bin/git (Intel Macs) git --version # git version 2.43.0
echo 'export PATH="/opt/homebrew/bin:$PATH"' >> ~/.zshrcThen open a new terminal.
Option 2 — Xcode Command Line Tools
If you do not want a package manager, just type git in Terminal. macOS will offer to install the Command Line Tools. Click Install, wait a few minutes, and you have Git.
Or trigger it manually
xcode-select --install
This installs Apple’s Git plus a bunch of other developer tools (clang, make, etc.). The Git version may lag a release or two behind, which is rarely a problem.
Option 3 — Official installer
Download a .pkg from https://git-scm.com/download/mac. Open it, drag through the install wizard, done. This is fine for non-technical users who just want Git without a package manager.
Option 4 — MacPorts
If you use MacPorts instead of Homebrew:
sudo port install git
First-time configuration
Tell Git who you are
git config --global user.name "Your Name" git config --global user.email "you@example.com" git config --global init.defaultBranch main # Useful defaults git config --global core.editor "code --wait" # VS Code git config --global pull.rebase false git config --global core.autocrlf input # convert CRLF to LF on commit
Verify
git --version git config --global user.name git config --global user.email
Updating Git
Homebrew:
brew update && brew upgrade gitCommand Line Tools: install macOS updates from System Settings → General → Software Update; Git updates come along for the ride.
Official installer: re-download the latest
.pkgfrom git-scm.com.
Terminal apps
Terminal.app — built into macOS. Perfectly fine.
iTerm2 — popular free upgrade with split panes, search, scripting. Highly recommended.
Warp / Hyper / Kitty / Alacritty — modern alternatives. Any of them work fine with Git.
Apple Silicon vs Intel
Both architectures work identically. The only practical difference is the Homebrew install path:
Apple Silicon (M1/M2/M3/M4):
/opt/homebrewIntel Macs:
/usr/local
Common problems
xcrun: error: invalid active developer path— macOS lost track of the Xcode Command Line Tools. Runxcode-select --installto repair.Old Git from Apple is taking precedence over Homebrew Git — adjust your PATH so Homebrew comes first (see Note above).
git: command not foundon first use — the install script needs a new terminal session, or Homebrew’s shell init has not been added to~/.zshrc.Permissions errors — never use
sudowithgitfor normal work. If you see permission denied on a folder, it is probably a directory permission issue, not a Git issue.