环境
mac系统版本:macOS Mojave10.14.5
ruby:ruby 2.3.7p456 (2018-03-28 revision 63024)
问题(issues)
使用sudo gem install cocoapods
更新!报错如下:
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 ./siteconf20200309-13044-14m1r7i.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>
尝试了gem update --system
、xcode-select --install
、sudo apt-get install ruby-dev
等方法都未解决该问题!
最终解决方法
open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
根据提示安装即可
参考链接: https://github.com/castwide/vscode-solargraph/issues/78#issuecomment-535210783