Is there a way to know the Default Installation Directory of XCode through command line? (I know default is /Developer, but what if i changed it to /XCode42, then in this case how can i get path)
Also where is those environment variables are set and what are the names for those variables? (As in windows we are giving Path for Java)
This will do
xcode-select --print-path
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With