xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/D...

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer错误的解决办法

命令行打包sdk时,突然报错。可能是路径不对,然后就进行排查。

问题排查:

打开cmd,输入命令行查看xcode路径 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,提示路径不对

解决办法:

输入命令切换到正在用的Xcode路径下 sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer/ 

再次输入命令 验证是否切换成功 xcodebuild -showsdks

执行结果如下,路径切换成功,clean工程后再次编译即可。


xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/D..._第1张图片

结果:

安装多个Xcode,或者修改了编译工具和生成bundle的路径,都有可能导致这个问题。

你可能感兴趣的:(xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/D...)