Git versioning
I asked Grok
about git on my mac. when I open the terminal and use `git --version` it shows me version 2.24.3`. When I use `brew upgrade git` it gives me an error. When I use `brew install git` it installs stuff. When I then use `brew upgrade git` it says that version 2.53.0 is already installed. BUT when I use `git --version` it is still 2.24.3. How is this possible?
Answer
Hello! This is a very common situation on macOS — especially if you're a bit older in the macOS world (like many of us 😄). You're seeing exactly the classic "two gits" problem.
Let me explain step by step what is happening and how to fix it properly.
Why are you still seeing git 2.24.3?
macOS ships with its own git (usually called Apple Git), installed here:
Your current shell is finding this version first.
Homebrew installs a much newer git (in your case 2.53.0) into one of these locations (depending on whether you have Intel or Apple Silicon Mac):
- Intel:
/usr/local/bin/git - Apple Silicon (M1/M2/M3/M4…):
/opt/homebrew/bin/git
Because /usr/bin normally appears before /usr/local/bin or /opt/homebrew/bin in your $PATH, the system git "wins" — even after you install/upgrade via brew.
That's why:
brew upgrade git→ says 2.53.0 is already installed (correct!)- but
git --version→ still shows 2.24.3 (because you're running/usr/bin/git)
Quick diagnosis commands (run these now)
Please paste the output of these into your next message — it'll help confirm everything:
which git
echo $PATH | tr ':' '\n' | grep -E 'usr/bin|local|homebrew'
/usr/bin/git --version
/usr/local/bin/git --version # might fail on Apple Silicon — that's ok
/opt/homebrew/bin/git --version # might fail on Intel — that's ok
brew --prefix git
Most likely you'll see:
which git→/usr/bin/git- the new one lives in
/opt/homebrew/bin/gitor/usr/local/bin/git
Recommended fixes (choose one — I suggest option A or B)
A. Easiest & cleanest for most people (my recommendation)
Add Homebrew's bin folder in front of the path — so it is searched first.
-
Open your shell config file:
-
If you use zsh (default since macOS Catalina):
-
If you use bash:
-
Add this line at the end (choose the correct one for your Mac):
# For Apple Silicon (M-series)
export PATH="/opt/homebrew/bin:$PATH"
# ───────── OR ─────────
# For Intel Mac
export PATH="/usr/local/bin:$PATH"
-
Save (Ctrl+O → Enter → Ctrl+X in nano)
-
Apply the change:
Or just close & reopen the Terminal.
- Verify:
You should now see git version 2.53.0 (or whatever brew has).
B. Force Homebrew to "take over" the symlinks (sometimes needed)
Then close/reopen terminal and check git --version.
This is stronger — it overwrites any existing /usr/local/bin/git symlink if something else put it there.
C. Alias (quick & dirty — only if you want to keep both)
But I don't recommend this long-term — better to fix $PATH.
Bonus tips for Fab Academy
- In week 1 (or whenever you do version control / final project documentation), you'll push/pull a lot → newer git is much nicer (better defaults, performance, security fixes).
- Many students run into exactly this issue — you're not alone!
- Once fixed, just do
brew upgrade gitregularly — you'll stay current without pain.
Let me know what the diagnostic commands show, or if you run into any error when editing .zshrc — we can fix it together. You're very close! 🚀