Install using Homebrew (recommended)
- Install Homebrew if you don’t have it:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- Open the Terminal and Install Git:
brew install git
Install using MacPorts
- Install MacPorts if you don’t have it: https://www.macports.org/install.php
- Open the Terminal and Install Git:
sudo port install git
Install Using Xcode
- Open the Terminal.
- Run the following command:
xcode-select --install
- Follow the on-screen instructions to install the Command Line Tools.
- After installation, you can use Git from the Terminal.
Verify the Installation
After installing Git, you can verify the installation by running this command in the terminal. This should display the installed Git version.
git version