xcode-select 活动开发者目录错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17980759/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
xcode-select active developer directory error
提问by tjmehta
Saw the following error when running an npm install
which required node-gyp
... but could be triggered by anything which requires xcode-select
.
运行npm install
which required node-gyp
...时看到以下错误,但任何需要xcode-select
.
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
xcode-select: 错误:工具“xcodebuild”需要 Xcode,但活动开发者目录“/Library/Developer/CommandLineTools”是命令行工具实例
What is the problem?
问题是什么?
回答by tjmehta
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-select
开发者目录指向/Library/Developer/CommandLineTools
时,需要完整的常规 Xcode 时会发生此问题(在 Xcode 之后安装 CommandLineTools 时发生)
Solution:
解决方案:
- 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(从https://appstore.com/mac/apple/xcode获取 )。
- 接受条款和条件。
- 确保 Xcode 应用程序在
/Applications
目录中 (NOT/Users/{user}/Applications
)。 xcode-select
使用以下命令指向Xcode 应用程序开发者目录:sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
Note: Make sure your Xcode app path is correct.
注意:确保您的 Xcode 应用程序路径正确。
- Xcode:
/Applications/Xcode.app/Contents/Developer
- Xcode-beta:
/Applications/Xcode-beta.app/Contents/Developer
- 代码:
/Applications/Xcode.app/Contents/Developer
- Xcode-测试版:
/Applications/Xcode-beta.app/Contents/Developer
回答by Indamix
Other solution for those who don't want to install Xcode:
对于不想安装 Xcode 的人的其他解决方案:
Install Command Line Tools (if you haven't already):
xcode-select --install
Change the active directory:
sudo xcode-select -switch /Library/Developer/CommandLineTools
安装命令行工具(如果您还没有):
xcode-select --install
更改活动目录:
sudo xcode-select -switch /Library/Developer/CommandLineTools
This worked for me (git).
这对我有用(git)。
回答by jay.tech66
I was having an issue while trying to install packages using npm. I got the error: "sudo xcode-select -s /Applications//Xcode.app/Contents/Developer/"
我在尝试使用 npm 安装软件包时遇到问题。我收到错误:“sudo xcode-select -s /Applications//Xcode.app/Contents/Developer/”
To fix this
要解决这个问题
- I opened Xcode.
- Preferences
- Locations
- Selected the Command Lin Tools: Xcode 6.1.1
- 我打开了Xcode。
- 喜好
- 地点
- 选择命令行工具:Xcode 6.1.1
Now when installing packages with npm I no longer get errors.
现在,当使用 npm 安装软件包时,我不再出现错误。
回答by FranklinA
Xcode->Preferences->Locations->command line tools
Xcode->首选项->位置->命令行工具
Select the option: Xcode 8.x
选择选项:Xcode 8.x
回答by chunkyguy
Simply run sudo xcode-select -r
which should automatically reset the path.
只需运行sudo xcode-select -r
它应该会自动重置路径。
-r, --reset
Unsets any user-specified developer directory, so that the developer directory will be found via the default search mechanism. This command must be
run with superuser permissions (see sudo(8)), and will affect all users on the system.
回答by Andrey Deineko
Just in case you're using xcode beta:
以防万一您使用的是 xcode beta:
sudo xcode-select -s /Applications/Xcode-Beta.app/Contents/Developer
回答by Hamoon Jamshidi Meydandar
I had to run this first
我必须先运行这个
sudo xcode-select --reset
then
然后
sudo xcode-select -switch /Library/Developer/CommandLineTools
and then it worked.
然后它起作用了。
回答by Rahul Shenoy
Download Xcode from App Store.
Go to Xcode preferences/Locations/CommandlineTools
You just have to set it to the Xcode version. It automatically points to '/Application/Xcode.app'
从 App Store 下载 Xcode。
转到 Xcode 首选项/位置/CommandlineTools
您只需将其设置为 Xcode 版本即可。它自动指向'/Application/Xcode.app'
回答by javamonk
Without Xcode: create file /usr/local/bin/xcodebuild
with content to cheat XcodeSelect
没有 Xcode:创建/usr/local/bin/xcodebuild
包含内容的文件来欺骗 XcodeSelect
#!/bin/bash
exit 0
chmod +x /usr/local/bin/xcodebuild
chmod +x /usr/local/bin/xcodebuild
回答by sandeepkohli
Install Xcode from App Store. After installing run xcodebuild with root privileges i.e. sudo xcodebuild
and accept the language. After this npm install bcrypt
worked like a charm!
从 App Store 安装 Xcode。安装后以 root 权限运行 xcodebuildsudo xcodebuild
并接受语言。在这之后npm install bcrypt
就像一个魅力!