Link Search Menu Expand Document

Install Git on macOS

Section 1: Checking your version of Git

  1. 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
    

    Github_mac_os_version_check

  2. 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.

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.

  1. 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/

  2. Update Homebrew and install Git:

     brew update
     brew install git
    
  3. Re-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:

  1. Visit the official Git download page: https://git-scm.com/download/mac

  2. 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
  3. Choose the method that works best for your system and follow the instructions provided on the Git website.

  4. 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.


^
TOP

Copyright @ 2025 CityU STC