xcode-select: error: tool 'xcodebuild' requires Xcode错误的解决办法

在命令行交叉编译iPhone程序的时候

$ xcrun --sdk iPhoneOS --show-sdk-path

xcrun: error: SDK "iPhoneOS" cannot be located

xcrun: error: SDK "iPhoneOS" cannot be located

xcrun: error: unable to lookup item 'Path' in SDK 'iPhoneOS'

根据以前Linux的经验,这个可能是路径不对,然后就进行排查

xcode-select --print-path

/Library/Developer/CommandLineTools

发现这个并不是我的Xcode路径,

$ xcodebuild -showsdks

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

额,果然,提示路径不对,那怎么办呢

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

用这个命令切换到你正在用的Xcode安装路径下。

再来看看

$ xcodebuild -showsdks

2016-01-31 10:24:31.499 xcodebuild[782:29058] [MT] PluginLoading: Required plug-in compatibility UUID F41BD31E-2683-44B8-AE7F-5F09E919790E for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/XAlign.xcplugin' not present in DVTPlugInCompatibilityUUIDs

2016-01-31 10:24:31.500 xcodebuild[782:29058] [MT] PluginLoading: Required plug-in compatibility UUID F41BD31E-2683-44B8-AE7F-5F09E919790E for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/VVDocumenter-Xcode.xcplugin' not present in DVTPlugInCompatibilityUUIDs

2016-01-31 10:24:31.501 xcodebuild[782:29058] [MT] PluginLoading: Required plug-in compatibility UUID F41BD31E-2683-44B8-AE7F-5F09E919790E for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/OMColorSense.xcplugin' not present in DVTPlugInCompatibilityUUIDs

2016-01-31 10:24:31.502 xcodebuild[782:29058] [MT] PluginLoading: Required plug-in compatibility UUID F41BD31E-2683-44B8-AE7F-5F09E919790E for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/KSImageNamed.xcplugin' not present in DVTPlugInCompatibilityUUIDs

OS X SDKs:

OS X 10.11                    -sdk macosx10.11


iOS SDKs:

iOS 9.2                       -sdk iphoneos9.2


iOS Simulator SDKs:

Simulator - iOS 9.2           -sdk iphonesimulator9.2


tvOS SDKs:

tvOS 9.1                      -sdk appletvos9.1


tvOS Simulator SDKs:

Simulator - tvOS 9.1          -sdk appletvsimulator9.1


watchOS SDKs:

watchOS 2.1                   -sdk watchos2.1


watchOS Simulator SDKs:

Simulator - watchOS 2.1       -sdk watchsimulator2.1


$ xcrun --sdk iphoneos --show-sdk-path


又可以进行交叉编译了!

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

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值