سؤال

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