Skip to content

Instantly share code, notes, and snippets.

@ngeorger
Last active June 24, 2024 21:52
Show Gist options
  • Save ngeorger/075bd48cc02ae5b332b3197ca87a5dc1 to your computer and use it in GitHub Desktop.
Save ngeorger/075bd48cc02ae5b332b3197ca87a5dc1 to your computer and use it in GitHub Desktop.
How to use Homebrew Git as default in macOS

How to use Homebrew Git as default in macOS

# Install Brew:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Install git from Homebrew

brew install git

Brew uses different paths according to your CPU arch.

For mac intel:

## zsh (default shell in macOS)
⁠echo 'export PATH="/usr/local/bin:$PATH”' >> ~/.zshrc

## bash

echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.bashrc

For mac arm64

#⁠### zsh (default)

echo 'export PATH="/opt/homebrew/bin:$PATH"' >> ~/.zshrc

#### bash

echo 'export PATH="/opt/homebrew/bin:$PATH"' >> ~/.bashrc

⁠## Restart your Terminal or reload the profile with

#### zsh
source ~/.zshrc

#### bash
source ~/.bashrc

Now, you should see the homebrew git version when you run

git --version && which git
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment