So, you’re new to macOS and ready to set up Git? Great choice! Git is one of the essential tools for developers, and installing it should be one of the first steps in your journey. Don’t worry—it’s easier than you think. Let’s get started!
Check if Git is already installed
If you’re just setting up your Mac, it’s unlikely that Git is already installed. macOS doesn’t come with a fully functional Git by default. Instead, it includes a placeholder located at /usr/bin/git
. This placeholder acts as a link to the actual Git version, which gets installed with Xcode or the Command Line Tools. Just to be sure, open your terminal and type
git --version
If you see something like
No developer tools were found, requesting install
it means that macOS detected that you tried to use a command line developer tool – git
in this case – but the Xcode Command Line Tools are not installed on your system.
Install Git on Mac using Xcode
Xcode is actually the easiest way to install Git on your system. Since Xcode Command Line tools include Git in the package, to use Git all you need to do is type the following command in your terminal
xcode-select --install
lookup the installation popup and click Install.
In the extreme case you don’t see a popup, check to be sure you are connected to the internet.
After the installation process is finished, try again and type
git --version
You should now see
git version 2.39.5 (Apple Git-154)
Install Git on Mac using Homebrew
Another popular way to install Git on macOS, apart from using Xcode Command Line Tools, is by using Homebrew. This method is often preferred by developers who want more control over the Git version or are already using Homebrew for managing other software.
To install Git using Homebrew run the following command
brew install git
Running this command will display some logs related to the Git installation, such as:
....
==> Installing git
==> Pouring git--2.47.1.arm64_sequoia.bottle.tar.gz
==> Caveats
The Tcl/Tk GUIs (e.g. gitk, git-gui) are now in the `git-gui` formula.
Subversion interoperability (git-svn) is now in the `git-svn` formula.
zsh completions and functions have been installed to:
/opt/homebrew/share/zsh/site-functions
==> Summary
🍺 /opt/homebrew/Cellar/git/2.47.1: 1,685 files, 54.4MB
==> Running `brew cleanup git`...
....
Once the installation process is complete, you can verify that Git was installed successfully by typing:
git --version
You should see
git version 2.39.5 (Apple Git-154)
With Git successfully installed, you’re now ready to dive into your development journey and take full control of your projects!