why does the which command output the same path twice? Why does this command have this output?

$which -a python
/usr/local/bin/python
/usr/local/bin/python
/usr/bin/python


Specifically, why is "/usr/local/bin/python" listed twice?

The "/usr/local/bin" directory only occurs once in my PATH.

I've only noticed this happening for homebrew installed software thus far.

I'm not certain exactly which version of the which command I am using.
But I think it comes from Apple.

$which -a which
/usr/bin/which
which searches your PATH variable for instances of the program. With a -a option it lists all instances of the program's path. Your PATH variable has two instances of /usr/local/bin, that is why you see the program path listed twice.