Mac Angular打包报错xcode-select: error: tool 'xcodebuild' requires Xcode

Mac Angular打包报错:

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

Angular项目运行,打包需安装环境如下:

1:安装node(自己去官网下载指定版本安装,Angular1.0这种过时的项目是不支持高版本node的),cordova,gulp等。

2:安装xcode。

运行打包命令:gulp build:ios:release 报错如上所述,由于我们在苹果商店下载的程序安装在Applications目录,与/Library/Developer/CommandLineTools目录不一致。

解决方案:

使用以下命令把 xcode 的路径修改为你安装的位置即可

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