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

本文介绍了解决在Mac上安装Vapor时遇到的Xcode版本冲突问题。通过调整Xcode的开发者目录,成功安装了Vapor,并解决了由于安装了多个Xcode版本而导致的问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 

用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 don't 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 we'll 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的时候,就要注意

 

转载于:https://www.cnblogs.com/gongyuhonglou/p/8963396.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值