shou2017.com
JP

Installing Git with Homebrew on Mac

Thu Feb 13, 2020
Sat Aug 10, 2024
Git

Environment

  • macOS Catalina 10.15.3
  • zsh

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.

Check the version of git installed by default

 $ 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.

Install Git with 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

改訂2版 わかばちゃんと学ぶ Git使い方入門

See Also