macOS Mojave 系统版本10.14.4
sudo gem install -n /usr/local/bin cocoapods
sudo gem install -n /usr/local/bin cocoapods
Password:
Building native extensions. This could take a while...
ERROR: Error installing cocoapods:
ERROR: Failed to build gem native extension.
current directory: /Library/Ruby/Gems/2.3.0/gems/ffi-1.12.2/ext/ffi_c
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -r ./siteconf20200328-38001-wprlv8.rb extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/include/ruby.h
extconf failed, exit code 1
Gem files will remain installed in /Library/Ruby/Gems/2.3.0/gems/ffi-1.12.2 for inspection.
Results logged to /Library/Ruby/Gems/2.3.0/extensions/universal-darwin-18/2.3.0/ffi-1.12.2/gem_make.out
安装cocoapods失败
Installing CocoaPods1.9.0 on Mojave10.14.6 resulted in the following
Forcibly, Installing CocoaPods1.8.4 works fine.
类似的问题:
https://github.com/CocoaPods/CocoaPods/issues/9568
This does not appear to be an issue with CocoaPods rather with your system unable to install the gem:
FWIW, I was just able to install CocoaPods 1.9.0 on Mojave 10.14.6, but I had to upgrade Ruby from 2.3 (whatever was installed) to Ruby 2.6.3.
Could it be that CocoaPods 1.9 requires a higher version of Ruby than what's shipped with Mojave 10.14.6.?
This should be re-opened, I can repro on a clean Mojave. The workaround is to run sudo gem install cocoapods -v 1.8.4.
This question has been asked on StackOverflow:
* [gem native extension error while installing cocoapods](https://stackoverflow.com/q/60585707/190298)
And on AskDifferent, the Apple-specific site on Stack Exchange:
* [Installing cocoapods on macOS Mojave](https://apple.stackexchange.com/q/384382/18101)
解决思路:
https://apple.stackexchange.com/questions/384382/installing-cocoapods-on-macos-mojave
网友评论