How to Upgrade/Update Git to the Latest Version on Mac

Need to upgrade/update git to the latest version on your Mac? The following should do the trick:

First, if you don’t already have homebrew installed, install homebrew:

$ /usr/bin/ruby -e "$(curl -fsSL"

Then update/upgrade brew:

$ brew update

$ brew upgrade

Install the latest version of git with homebrew:

$ brew install git

Now, make sure to close your terminal app. This is key because if you don’t close your terminal app and then re-open it, your terminal will not recognize the latest version installed via homebrew.

In a new terminal window, run the following to confirm you are now running the latest version of git:

$ git --version