您的位置:首页 > 产品设计 > UI/UE

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

2016-01-31 10:37 531 查看
在命令行交叉编译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的时候,就要注意了
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: