$ 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
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`)
9 回答
使用
xcode-select -switch
选择默认使用的Xcode版本 .在我的情况下,我不得不:
安装Xcode的命令行工具,转到首选项 - >位置并为命令行工具设置正确的值 .
在下载 - >组件选项卡中,我在名为命令行工具的行上单击安装 .
Marmalade开始与Xcode合作 .
如果您运行此命令:
它将打印到屏幕如下:
/Volumes/Xcode/Xcode44-DP7.app/Contents/Developer(在您的情况下)
要将其更改为默认值,您可以执行以下操作:
再检查一遍:
获取更多信息:
Open xcode and navigate to preferences...
Select Location of xcode from command line tools.
After that perform command from terminal.
或者,改为覆盖DEVELOPER_DIR环境变量:
此设置对每个用户帐户都是唯一的 . 如果存在,它将覆盖
xcode-select
选项 .可选:您可以通过编辑.bash_profile文件在登录会话之间保持此状态 .
sudo xcode-select --switch / Library / Developer / CommandLineTools适合我 .
为了您的信息,我搞砸了我的配置:
我试图通过终端获得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
我得到以下错误:
最初,我有两个xcode 7.3和8.0 . 我将 xcode 的名称保留为7.0,将 xcode 8 保留为8.0 .
我从应用程序中删除了 xcode for 7.0,并将 xcode 8 重命名为 xcode .
在Xcode的偏好中它很适合位置 xcode 8 但它不在那里 .
我使用命令更改了位置:
Git Command工作,我可以从GIT下载项目 .
您也可以从Xcode首选项中执行此操作 .
有效 .