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

运行xcode命令报错:

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

直接百度错误提示信息找这篇贴子

博主找到的原因是:

升级Xcode后,不是系统默认位置。我想我是直接安装最新版的xcode应该也是这样的问题。

解决的办法是:

修改xcode指向的目录 

xcode-select -s /Applications/Xcode.app/Contents/Developer

再次执行xcodebuild就可以正确执行了

1 sh-3.2# xcodebuild
2 note: Using new build system
3 note: Planning build
4 note: Constructing build description
5 Build system information
6 error: Signing for "HelloWorld" requires a development team. Select a development team in the project editor. (in target 'HelloWorld') 7 8 ** BUILD FAILED **

我这边build failed是因为还没有配置开发者账号

by the way 查看xcode安装目录的命令:

这是在未修改xcode命令指向新目录前,是系统默认的位置 

sh-3.2# xcode-select --print-path
/Library/Developer/CommandLineTools

这是修改后,再次查看,xcode命令指向xcode的安装目录已经变了 

sh-3.2# xcode-select --print-path
/Applications/Xcode.app/Contents/Developer

猜你喜欢

转载自www.cnblogs.com/kaerxifa/p/11130582.html
今日推荐