macOS
Installation of Git on macOS.
On macOS
Using Xcode Command Line Tools
xcode-select --install
Recommended:
This is the recommended method for most users as it's officially supported by Apple.
This command will open a dialog box to install the command line tools. Follow the instructions to install the tools.
Using Homebrew
brew install git
If you don't have Homebrew installed, you can install it by running:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
Using MacPorts
sudo port install git
If you don't have MacPorts installed,
Visit MacPorts website to download and install the package for your macOS version.
Verifying the Installation
After installation, you can verify the installation by running:
git --version
Or
git -v