I recently did a clean install of my Mac and was surprised to find that git comes installed by default. So, I’m making a note of how to install git using Homebrew.
Since I’m using macOS Catalina, I’m working with zsh instead of bash.
$ git --version
git version 2.21.1 (Apple Git-122.3)
At the time of writing, according to the official git site, the current version is 2.25.0, so there’s not much difference from what’s installed by default.
Confirming that Git is not installed through Homebrew
$ brew list
hugo mas
Git isn’t shown in the list, so as expected, it’s not installed through Homebrew.
$ brew install git
Now we need to set up the PATH, but the terminal helpfully tells us what to do, so I just copy and paste:
If you need to have gettext first in your PATH run:
echo 'export PATH="/usr/local/opt/gettext/bin:$PATH"' >> ~/.zshrc
We need to apply the shell configuration, so execute the following command:
$ source ~/.zshrc
Finally, let’s check that everything is working correctly:
$ git --version
git version 2.25.0