Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can i make ZSH use the latest git version?

Tags:

git

path

macos

zsh

I am using ZSH with oh-my-zsh on OS X.

Today I used hombrew to update to the latest version of git (1.8.something).

However, if I run

➜  ~  git --version
git version 1.7.10.2 (Apple Git-33)

I see that still an older version is used. On bash everything works fine and the latest version of git is called.

Since I am new to ZSH, any advice on how to set up ZSH to use the "new" git is appreciated!

Best,

Tobi

like image 912
tobias.henn Avatar asked Dec 12 '25 13:12

tobias.henn


2 Answers

This means that your $PATH variable isn't set up to include the right git (and everything else homebrew installs).

Try doing echo $PATH from both bash and zsh. You should see at least one difference: the directory where you installed homebrew, probably /usr/local/bin. (It'll either not be in there, or be after /usr/bin, where the Apple-supplied binary lives.)

To fix it, add a line like

export PATH=/usr/local/bin:$PATH

to your ~/.zshenv.

like image 56
Danica Avatar answered Dec 15 '25 12:12

Danica


If the PATH modification didn't instantly work, you need to realize that with zsh you need to type "rehash" for zsh to recognize there are new executables in the path. Or just log out and back in.

like image 43
Kalle Pokki Avatar answered Dec 15 '25 13:12

Kalle Pokki



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!