可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
How can I change the directory at which xcrun is pointing ? currently is pointing to
xcrun: Error: could not stat active Xcode path '/Volumes/Xcode/Xcode44-DP7.app/Contents/Developer'. (No such file or directory)
I need to change the location. Thank you.
回答1:
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
回答2:
Use xcode-select -switch to choose which version of Xcode you're using by default.
回答3:
In my case, i had to:
- Install Xcode's command line tools, going to preferences -> Locations and setting a correct value to Command Line Tools.
- In Downloads -> Components tab, I clicked install on a line called Command Line tools.
- Marmalade started working fine with Xcode.
回答4:
If you run this command:
$ xcode-select -p
it will print to screen as below:
/Volumes/Xcode/Xcode44-DP7.app/Contents/Developer ( in your case)
To change it to default, you can do as follow:
$ sudo xcode-select -r Password:
Check again:
$ xcode-select -p /Applications/Xcode.app/Contents/Developer
Get more information from:
$ xcode-select Usage: xcode-select [options] Print or change the path to the active developer directory. This directory controls which tools are used for the Xcode command line tools (for example, xcodebuild) as well as the BSD development commands (such as cc and make). Options: -h, --help print this help message and exit -p, --print-path print the path of the active developer directory -s , --switch set the path for the active developer directory -v, --version print the xcode-select version -r, --reset reset to the default command line tools path
回答5:
sudo xcode-select --switch /Library/Developer/CommandLineTools
回答6:
Open xcode and navigate to preferences...

Select Location of xcode from command line tools.
After that perform command from terminal.
回答7:
Alternatively, override the DEVELOPER_DIR environment variable instead:
export DEVELOPER_DIR="/Applications/Xcode.app/Contents/Developer"
This setting is unique to each user account. If present, it overrides the xcode-select choice.
Optional: you can make this persist between login sessions by editing your .bash_profile file.
回答8:
sudo xcode-select --switch /Library/Developer/CommandLineTools works for me.
For your information I screw up my config with this :
sw_vers -productVersion | grep -E '^10\.([89]|10)' >/dev/null && bash -c "[ -d /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain ] && sudo -u $(ls -ld /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain | awk '{print $3}') bash -c 'ln -vs XcodeDefault.xctoolchain /Applications/Xcode.app/Contents/Developer/Toolchains/OSX$(sw_vers -productVersion).xctoolchain' || sudo bash -c 'mkdir -vp /Applications/Xcode.app/Contents/Developer/Toolchains/OSX$(sw_vers -productVersion).xctoolchain/usr && for i in bin include lib libexec share; do ln -s /usr/${i} /Applications/Xcode.app/Contents/Developer/Toolchains/OSX$(sw_vers -productVersion).xctoolchain/usr/${i}; done'"
回答9:
I was trying to get Git Clone through Terminal.
User-Mac-mini:~ user_name$ cd /Users/yser_name/Documents/Developer/Xcode_Projects/Xcode_Proj/AAG/EJ
user-Mac-mini:EJ user_name$ git clone https://smaplebitbucket.org/projectname/sample.git
I got below error:
xcrun: error: active developer path ("/Applications/Xcode 8.app/Contents/Developer") does not exist, use `xcode-select --switch path/to/Xcode.app` to specify the Xcode that you wish to use for command line developer tools (or see `man xcode-select`)
Intially I had two xcode 7.3 and 8.0. I kept name of xcode for 7.0 and xcode 8 for 8.0.
I deleted the xcode for 7.0 from Applications and rename xcode 8 to xcode.
In Xcode preference it was poiting to location xcode 8 but it was not there.
I changed the location using command :
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
Git Command worked and i was able to download the project from GIT.
you can also do it from Xcode preference too.

It worked.