Install and upgrade Install Git on macOS Mojave, High Sierra, Sierra, El Capitan, Yosemite, Mavericks,

Install and upgrade Install Git on macOS Mojave, High Sierra, Sierra, El Capitan, Yosemite, Mavericks,
0

#1

The following tutorials work on all MacOS Versions: Mojave, High Sierra, Sierra, El Capitan, Yosemite, Mavericks, Mountain Lion, Lion, Leopard, Snow Leopard.

How to install Git on your MacOS?

Download and install the latest version of Git from here: http://git-scm.com/download/mac
2.20.1 is currently the latest version.

There is another quick way to install git through Homebrew
Enter the following command line:

brew install git

Instruction to install Homebrew.

How to upgrade Git on your MacOS?

We can check the current git version by using the following command line through Terminal (Found under /Application/Utilities/)

git --version

To upgrade Git from a previous version to the latest, firstly, we need to uninstall the current git, then download and install the latest version

  • To uninstall, use the following command line through Terminal since
/usr/local/git/uninstall.sh

After upgrading to Mojave, git is not working and users may face the following error:

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools)

That Xcode Command-line Tools needs to be updated causes the problem.

To fix, Go back to your terminal and hit:

xcode-select --install

You’ll then receive:

xcode-select: note: install requested for command line developer tools

And be prompted in a window to update Xcode Command Line tools.