I want to update git. I find this article:
On one of the first steps, I get a problem. When I tried to backup currently installed git I got permissions restriction. It's ok it must be some OSX system restriction.
I checked PATH and noticed that /usr/bin
is after /usr/local/bin
. So if I just install new version of git via brew this version will be used (since brew installs everything into /usr/local/bin
. I did that and the result frustrated me. Old git is using instead of installed via brew. Why?
Here is some output:
svlad at sharikovvlad in ~/sandbox/git-test on master [+]
$ git --version
git version 2.11.0 (Apple Git-81)
svlad at sharikovvlad in ~/sandbox/git-test on master [+]
$ which git
/usr/local/bin/git
svlad at sharikovvlad in ~/sandbox/git-test on master [+]
$ ls -al /usr/local/bin/git | grep git
lrwxr-xr-x 1 svlad admin 28 Sep 3 18:16 /usr/local/bin/git -> ../Cellar/git/2.14.1/bin/git
svlad at sharikovvlad in ~/sandbox/git-test on master [+]
$ /usr/local/Cellar/git/2.14.1/bin/git --version
git version 2.14.1
svlad at sharikovvlad in ~/sandbox/git-test on master [+]
$ echo $PATH
/Users/svlad/bin:/usr/local/opt/[email protected]/libexec/gpgbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Frameworks/Mono.framework/Versions/Current/Commands
$
So why apple git is using? /usr/local/bin
is first in path so symlink from this folder must be used? So why I am getting old version?
Also, any thoughts how can I remove apple git?
/usr/bin
instead of/usr/local/bin
?local
dir is on the left and as I know macos try to find command in each dir in PATH and it is going from left to right. So git in/usr/local/bin
should be resolved firstly. Why git from/usr/bin
is used then?