Frage

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?

War es hilfreich?

Lösung

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

Andere Tipps

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
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top