How to Update Git on Mac

Abdul Jabbar Feb 02, 2024
  1. Homebrew on Mac
  2. Post-Homebrew Update Git on Mac
How to Update Git on Mac

While working on Git, it should be kept updated with the latest release to get the latest features of it. This article will discuss how to install and update the latest versions of Homebrew and Git on a personal computer.

Homebrew on Mac

Homebrew is a package manager that works for Mac and enables its users to install countless programs very efficiently with the latest features.

Install Homebrew on Mac

First, we need to check if the homebrew is installed on the personal computer or device, and if we don’t have homebrew on our personal computer, then we can install it.

Command:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Update Homebrew on Mac

If we don’t have the latest homebrew version, we can get it by running the following command to get the latest version on the personal computer or the server.

Command:

brew update

Post-Homebrew Update Git on Mac

Now when the homebrew is installed or updated on the personal computer, it’s time to update the Git on the personal computer. There are two methods for updating Git on Mac which are discussed below.

Basic Method

The simplest one is to accomplish it with the help of an official installer. Go to the Git website, firstly download the installation file from it, then run the installation process, followed by the wizard shown to update the latest version of Git.

This method is basic, and step-by-step guidelines are available to complete the process efficiently.

Install Git Via Homebrew on Mac

We can easily install Git via homebrew through the following steps.

Command:

brew install git

Update Git Via Homebrew on Mac

After installing, we can check the version of Git that has been installed.

Command:

git --version

We can update it via homebrew if it’s not the version we need.

Command:

brew upgrade git

To confirm the updated version, again run the command below.

Command:

git --version

Suppose the output generated from this command has (Apple Git-101) written. In that case, the default version of Apple is still present on our personal computer instead of the official one, which always comes with the basic installation.

To resolve this issue, we will change our local path to the Homebrew version of Git.

Command:

export PATH=/usr/local/bin:$PATH
Author: Abdul Jabbar
Abdul Jabbar avatar Abdul Jabbar avatar

Abdul is a software engineer with an architect background and a passion for full-stack web development with eight years of professional experience in analysis, design, development, implementation, performance tuning, and implementation of business applications.

LinkedIn

Related Article - Git Update