Xcode - xcode-select: error: tool 'xcodebuild' requires Xcode报错解决方案

Posted 公羽寒

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Xcode - xcode-select: error: tool 'xcodebuild' requires Xcode报错解决方案相关的知识,希望对你有一定的参考价值。

 

用mac 自带的终端执行的命令,安装安装Vapor和toolbox

安装指令:

macdeMacBook-Pro:~ mac$ curl -sL check.vapor.sh| bash

 

结果报这个错误:

xcode-select: error: tool xcodebuild‘ requires Xcode, but active developer directory ‘/Library/Developer/CommandLineTools‘ is a command line tools instance
??  We dont recognize your Command Line Tools version.

Open Xcode and make sure the correct SDK is selected:
??  Xcode > Preferences > Locations > Command Line Tools

Expected: Xcode 8 or 9 (Any Build Number)
Current: 

??  Visit our docs for step-by-step instructions on installing Swift correctly.
http://docs.vapor.codes

??  or Join our Slack and well help you get setup.
http://vapor.team

 

看到这里发现是提示路径不对

Open Xcode and make sure the correct SDK is selected:
??  Xcode > Preferences > Locations > Command Line Tools

 

用这个命令切换到你正在用的Xcode安装路径下(需要输入Mac密码)

macdeMacBook-Pro:~ mac$ sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer/
Password:

 

 

macdeMacBook-Pro:~ mac$ curl -sL check.vapor.sh| bash
?  Xcode 9 is compatible with Vapor 2.
?  Xcode 9 is compatible with Vapor 3.
?  Swift 4.1 is compatible with Vapor 2.
?  Swift 4.1 is compatible with Vapor 3.

结果成功了!

为什么会出现这种错误呢,原来是我安装了2个Xcode。所以,安装了多个Xcode的时候,就要注意

 

以上是关于Xcode - xcode-select: error: tool 'xcodebuild' requires Xcode报错解决方案的主要内容,如果未能解决你的问题,请参考以下文章

xcode-select装不上的错误应对和OCR视频系列一二

使用 cli 工具包时的 xcode-select -switch 路径

无法安装命令行工具,“xcode-select --install”不起作用

Xcode - xcode-select: error: tool 'xcodebuild' requires Xcode报错解决方案

jenkins 构建xcode-select -s 切换xcode版本失败 (切换xcode路径无效)

iOS开发中常用命令工具(xcode-select、lipo、xcrun等)