更改xcrun开发人员path

如何更改xcrun指向的目录? 目前正在指向

xcrun:错误:无法stat激活Xcodepath'/Volumes/Xcode/Xcode44-DP7.app/Contents/Developer'。 (无此文件或目录)

我需要改变位置。 谢谢。

sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer 

使用xcode-select -switch来select默认使用的Xcode版本。

就我而言,我不得不:

  1. 安装Xcode的命令行工具,进入首选项 – > 位置,并为命令行工具设置正确的值。
  2. 下载 – > 组件选项卡中 ,我点击安装在名为命令行工具的行上
  3. 果酱开始与Xcode工作正常。

如果你运行这个命令:

 $ xcode-select -p 

它会打印到屏幕上,如下所示:

/Volumes/Xcode/Xcode44-DP7.app/Contents/Developer (在你的情况下)

要将其更改为默认值,您可以执行以下操作:

 $ sudo xcode-select -r Password: 

再检查一遍:

 $ xcode-select -p /Applications/Xcode.app/Contents/Developer 

从以下获取更多信息:

 $ 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 

打开xcode并导航到首选项…

在这里输入图像说明

从命令行工具中selectxcode的位置。

在这里输入图像说明 之后从terminal执行命令。

 sudo xcode-select --switch /Library/Developer/CommandLineTools 

或者,也可以改为使用DEVELOPER_DIR环境variables:

 export DEVELOPER_DIR="/Applications/Xcode.app/Contents/Developer" 

此设置对每个用户帐户都是唯一的。 如果存在,它将覆盖xcode-select选项。

可选:通过编辑.bash_profile文件,可以在login会话之间保持这种状态。

sudo xcode-select –switch / Library / Developer / CommandLineTools适用于我。

为了您的信息,我搞砸了我的configuration:

  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'" 

我试图通过terminal得到Git克隆。

  1. User-Mac-mini:〜user_name $ cd / Users / yser_name / Documents / Developer / Xcode_Projects / Xcode_Proj / AAG / EJ

  2. user-Mac-mini:EJ user_name $ git clone https://smaplebitbucket.org/projectname/sample.git

我得到了以下错误:

 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`) 

我有两个xcode 7.3和8.0。 我保留了7.0的xcode名称和8.0的xcode 8名称。

我从应用程序中删除了xcode 7.0,并将xcode 8重命名为xcode
在Xcode的偏好,它是位于xcode 8的位置,但它不在那里。

我改变了使用命令的位置:

  sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer 

Git Command工作,我能够从GIT下载项目。

你也可以从Xcode首选项中完成。

在这里输入图像说明

有效。