我正在特灵安装cocoapods是使用这个命令:sudo gem install cocoapods
我试过更新Ruby,卸载并重新安装Ruby,这样我就可以安装Cocoapods了。
下面是我的错误:
Building native extensions. This could take a while...
ERROR: Error installing cocoapods:
ERROR: Failed to build gem native extension.
----More error response----
current directory: /Library/Ruby/Gems/2.6.0/gems/ffi-1.16.3/ext/ffi_c
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r ./siteconf20231019-2526-1y2jjsl.rb extconf.rb
checking for ffi.h... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Library/Ruby/Gems/2.6.0/extensions/universal-darwin-21/2.6.0/ffi-1.16.3/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /Library/Ruby/Gems/2.6.0/gems/ffi-1.16.3 for inspection.
Results logged to /Library/Ruby/Gems/2.6.0/extensions/universal-darwin-21/2.6.0/ffi-1.16.3/gem_make.out
字符串
sudo gem update —system
我尝试运行此更新。xcode-select --install
,也试过这个,因为我看到有人说它对他们有效。这个也不起作用。
任何人都面临这个问题,你是如何解决的?
1条答案
按热度按时间3pvhb19x1#
更新-我如何解决这个问题:
mkmf.log
中,您可以找到您应该拥有的universal-darwinxx文件。cd $(xcode-select -p)/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0
以确认您当前拥有的文件。我发现我有universal-darwin22
sudo ln -sf universal-darwin22 universal-darwin21
。这个命令创建一个名为universal-darwin21
的符号链接,指向universal-darwin22
。sudo gem install cocoapods
命令时,您应该能够安装它而不会出现问题