if your xcode direcotry is in the path you can use the command which:
# which Xcode
this will return the path to the executable (only if it can be found using the PATH environment variable).
to find the enviroment variables open the shell and type (if you are using the bash shell):
# env
this will display the environment variables.
if you have the Xcode running you can run a ps command and grep the path from the output:
# ps -e -o command | grep Xcode | cut -d" " -f 1 | grep -e "Xcode$"
this will return you the path of the running Xcode (tested on my mac).
You can add your Xcode bin directory to your PATH by editing your .bashrc file and adding this line:
export PATH=$PATH:/Developer/Applications/Xcode.app/Contents/MacOS/
then do a
# source .bashrc
and then you can execute your Xcode form the command line by directly typing Xcode and the which command will return you the path to the Xcode.
which
command does not give me any output in Mac OS Lion Terminal. And when I runenv
it shows environment variables but not of XCode. So where does actually XCode saves the /Developer or other installed directory path?? – Oppugn