Question

I'm writing a mac app (osx 10.9) that accesses the terminal commands using NSTask and I wanted to run some of the commands from my app. Where are the terminal commands (gcc, mkdir,git) stored?

Was it helpful?

Solution

Use which to determine this:

% which gcc
/Applications/Xcode.app/Contents/Developer/usr/bin/gcc
% which mkdir
/bin/mkdir
% which git
/Applications/Xcode.app/Contents/Developer/usr/bin/git

OTHER TIPS

They can be scattered all over the place. You can see where individual commands are by using which

which mv
/bin/mv

Also, you can see what are all the paths that are used to search for a given command with the following:

echo $PATH
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top