In a Windows Command Prompt, I can find the location of things like Java and GIT by using the where command.

For example, typing where java yields C:\Program Files\Java\jdk1.8.0_05.

What is the macOS Terminal equivalent for the Windows Command Prompt command, where?

2 Answers 2


The which command prints the most precedent application on the PATH whereas where prints all matching applications on the path.

The difference manifests when you have side by side instances of an application installed and all set on the path. Strictly speaking which by itself returns the instance resolved first on the path left to right, where returns ALL found instances on the path resolved left to right. If you want to see what I'm talking about, on a Windows 7 or above system type:

where notepad you may see two paths returned

C:\>where notepad 

The real equivalence is

which -a someApp === where someApp


The macOS Terminal equivalent of the Windows Command Prompt command where is which.

Typing which java in my macOS Terminal yields /usr/bin/java, and which git yields /usr/bin/git.

  • Depending on the shell that you use then other shell builtin commands such as type, command, or whence could be used.
    – fd0
    Commented Feb 12, 2017 at 11:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .