xcode-select 活动开发者目录错误
在运行需要 node-gyp
的 npm install
时看到以下错误...代码>.
Saw the following error when running an npm install
which required node-gyp
... but could be triggered by anything which requires xcode-select
.
xcode-select: 错误:工具xcodebuild"需要 Xcode,但处于活动状态开发者目录 '/Library/Developer/CommandLineTools' 是一个命令线工具实例
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
有什么问题?
这个问题发生在 xcode-select
开发者目录指向 /Library/Developer/CommandLineTools
时需要完整的常规 Xcode(在 Xcode 之后安装 CommandLineTools 时发生)
This problem happens when xcode-select
developer directory was pointing to /Library/Developer/CommandLineTools
when a full regular Xcode was required (happens when CommandLineTools are installed after Xcode)
解决方案:
- 安装 Xcode(从 https://appstore.com/mac/apple/xcode) 如果您还没有.
- 接受条款和条件.
- 确保 Xcode 应用位于
/Applications
目录中(不是/Users/{user}/Applications
). - 使用以下命令将
xcode-select
指向 Xcode 应用程序开发者目录:sudo xcode-select -s/Applications/Xcode.app/Contents/Developer
- Install Xcode (get it from https://appstore.com/mac/apple/xcode) if you don't have it yet.
- Accept the Terms and Conditions.
- Ensure Xcode app is in the
/Applications
directory (NOT/Users/{user}/Applications
). - Point
xcode-select
to the Xcode app Developer directory using the following command:sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
注意:确保您的 Xcode 应用程序路径正确.
Note: Make sure your Xcode app path is correct.
- Xcode:
/Applications/Xcode.app/Contents/Developer
- Xcode-beta:
/Applications/Xcode-beta.app/Contents/Developer