How to install Git on Mac – MacOS for beginners

Avatar photo

By George

2 min read
Bookmark this post

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!

DigitalOcean Referral Badge
guest
0 Comments
Inline Feedbacks
View all comments

Continue reading

Quick Guides

How to install Homebrew – MacOS for beginners

Quick Guides

How to Add Sass to A Create-React-App Project

Quick Guides

Do You Still Need To Use npm install –save?

Quick Guides

How to Change The Default Port in A Create-React-App Project

Subscribe to our newsletter

Dive into the Fun Side of Tech! Posts, News, and More Delivered to Your Inbox!

Intuit Mailchimp