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?

有帮助吗?

解决方案

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

其他提示

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
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top