Find All Locations Of A Binary Using `type’ not `which’

I can’t find the git 2.10 binary so I run

which git

/usr/local/bin/git

Excellent, found it.

And then I check it’s version to verify I am looking at the right version

/usr/local/bin/git –version

git version 2.21.0

Oops that isn’t what I wanted.

There must be another git getting loaded earlier in the search path.

Here is how to find out where all copies of git live

type -a git

git is /usr/local/bin/git
git is /usr/local/bin/git
git is /usr/bin/git

Look for the right git at version 2.10

/usr/local/bin/git –version
/usr/bin/git –version

git version 2.21.0
git version 2.14.3 (Apple Git-98)

I want the second one.

That is how to track down the location of a binary file on macOS that appears multiple times in the search path.

Leave a Reply

Your email address will not be published. Required fields are marked *