当xcode-select
的开发者目录指向/Library/Developer/CommandLineTools
而需要完整的Xcode(在安装CommandLineTools后发生)时,会出现此问题。
解决方法:
/Applications
目录中(而不是/Users/{user}/Applications
)。xcode-select
指向Xcode应用程序的开发者目录:sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
注意:确保Xcode应用程序路径正确。
/Applications/Xcode.app/Contents/Developer
/Applications/Xcode-beta.app/Contents/Developer
10.14.5
安装中,我安装了命令行工具10.2.1,然后安装了Xcode 10.2.1,并得到了上述错误。然后,我尝试使用这个解决方案,但仍然得到了上述错误。Franklin A
的解决方案起作用了:https://dev59.com/7GMl5IYBdhLWcg3w966L#40819686 - Heath Borders我在尝试使用npm安装软件包时遇到了问题。
我收到了一个错误提示:“sudo xcode-select -s /Applications//Xcode.app/Contents/Developer/"
为了解决这个问题:
现在,当我使用npm安装软件包时,就不会再出现错误了。
对于那些不想安装Xcode的人,还有其他解决方案:
安装命令行工具(如果您尚未安装):
xcode-select --install
更改活动目录:
sudo xcode-select -switch /Library/Developer/CommandLineTools
这对我(git)有效。
xcode-select
了:http://cl.ly/image/2T0u2f2D471a/content - user1082754xcodebuild
的唯一方式是安装完整的 Xcode 吗?:-( - user1082754Xcode > 首选项 > 位置 > 命令行工具
选择与您的Xcode版本相匹配的选项。
xcode-select
命令会提示“错误:无效的开发者目录”! - mc01只需运行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.
我刚刚运行了以下命令,问题就解决了:
sudo xcode-select --reset
在终端中输入以下命令
xcode-select --install
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -license accept
如果您已经安装了XCode,您所需要做的就是...
如果你在使用Xcode beta版本,请注意:
sudo xcode-select -s /Applications/Xcode-Beta.app/Contents/Developer
我必须先运行这个
sudo xcode-select --reset
那么
sudo xcode-select -switch /Library/Developer/CommandLineTools
然后它起作用了。
--reset
就可以解决问题。 - Peter Lamberg