Background
This tutorial on how to "properly install git" on OSX 10.8.5, says:
To run the latest version you need to adjust your shell path so that /usr/bin/git runs after /usr/local/bin
...
So add into the path [in my case: ~/.bash_profile] similar to the below and keep what you already have in the path, each segment is separated by a colon:
export PATH="/usr/local/bin:/usr/bin/git:/usr/bin:/usr/local/sbin:$PATH"
^ Focus on this
So my understanding is this:
- when I log in, BASH will give priority to whatever is appended further on the right-hand side of the
export PATH=...
line - $PATH is at the righter-most
:
delimited entry in theexport PATH=...
line - $PATH contains
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
So... If my assumptions are correct, then surely the tutorial (quoted above) should have looked like:
export PATH="$PATH:/usr/bin/git"
Instead of:
export PATH="/usr/local/bin:/usr/bin/git:/usr/bin:/usr/local/sbin:$PATH"
My questions are:
Is the tutorial wrong? If not, then what of my assumptions are wrong? If my assumptions are not wrong AND the tutorial is not wrong, please explain why...
Note: I am aware this may not really be relevant to OSX 10.8.5, in which case please flag as off-topic to the appropriate Stack Exchange. But AFAIK, my Ubuntu machine has worked fine with ~/.bashrc having stuff like:
export PATH=$PATH:<myProgram1>:<myProgram2>:...
So it may be that BASH behaves differently in OSX? I don't know...
/usr/bin/git
is supposed to be after/usr/local/bin
, then useexport PATH="$PATH:/usr/bin/git"
, it's just that simple! – user3439894 Feb 27 '17 at 23:44bash
works, read its man page. How bash is depends more on its version then the OS. OS X/macOS tends to have older versions of bash then current Linux Distros. – user3439894 Feb 27 '17 at 23:50