xcode 更改 xcrun 开发者路径
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11456918/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
change xcrun developer path
提问by the Reverend
How can I change the directory at which xcrun is pointing ? currently is pointing to
如何更改 xcrun 指向的目录?当前指向
xcrun: Error: could not stat active Xcode path '/Volumes/Xcode/Xcode44-DP7.app/Contents/Developer'. (No such file or directory)
xcrun:错误:无法统计活动 Xcode 路径“/Volumes/Xcode/Xcode44-DP7.app/Contents/Developer”。(无此文件或目录)
I need to change the location. Thank you.
我需要改变位置。谢谢你。
回答by Vaibhav Saran
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
回答by Rob Napier
Use xcode-select -switch
to choose which version of Xcode you're using by default.
使用xcode-select -switch
来选择你默认情况下使用其的Xcode版本。
回答by imxylz
sudo xcode-select --switch /Library/Developer/CommandLineTools
回答by viktorvogh
In my case, i had to:
就我而言,我不得不:
- Install Xcode's command line tools, going to preferences-> Locationsand 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.
- 安装 Xcode 的命令行工具,转到首选项->位置并为Command Line Tools设置正确的值。
- 在Downloads-> Components 选项卡中,我在名为Command Line tools的行上单击了 install 。
- Marmalade 开始在 Xcode 中运行良好。
回答by biolinh
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)
/Volumes/Xcode/Xcode44-DP7.app/Contents/Developer(在你的情况下)
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 <path>, --switch <path> 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
回答by Amit Jagesha シ
回答by Aaron Brager
Alternatively, override the DEVELOPER_DIR environment variable instead:
或者,改写 DEVELOPER_DIR 环境变量:
export DEVELOPER_DIR="/Applications/Xcode.app/Contents/Developer"
This setting is unique to each user account. If present, it overrides the xcode-select
choice.
此设置对每个用户帐户都是唯一的。如果存在,它将覆盖xcode-select
选择。
Optional: you can make this persist between login sessions by editing your .bash_profile file.
可选:您可以通过编辑您的 .bash_profile 文件,使其在登录会话之间保持不变。
回答by Anil Gupta
I was trying to get Git Clone through Terminal.
我试图通过终端获取 Git Clone。
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
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 xcodefor 7.0 and xcode 8for 8.0.
最初我有两个 xcode 7.3 和 8.0。我 为 7.0保留了xcode 的名称,为 8.0保留了xcode 8 的名称。
I deleted the xcodefor 7.0 from Applications and rename xcode 8to xcode.
In Xcode preference it was poiting to location xcode 8but it was not there.
我从 Applications 中删除了7.0的xcode并将xcode 8重命名为xcode。
在 Xcode 偏好中,它指向位置xcode 8但它不在那里。
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.
Git 命令有效,我能够从 GIT 下载该项目。
you can also do it from Xcode preference too.
您也可以从 Xcode 首选项中执行此操作。
It worked.
有效。
回答by Vijender Kumar
You do not need to have xcode installed in order to use xcrun.
您无需安装 xcode 即可使用 xcrun。
Just install the xcode command line tools and switch to it.
只需安装 xcode 命令行工具并切换到它。
Install x code command line tools
安装 x 代码命令行工具
xcode-select --install
Switch to command line tools
切换到命令行工具
sudo xcode-select --switch /Library/Developer/CommandLineTools
回答by Youen Chene
sudo xcode-select --switch /Library/Developer/CommandLineTools works for me.
sudo xcode-select --switch /Library/Developer/CommandLineTools 对我有用。
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 }') 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'"