環(huán)境
mac系統(tǒng)版本: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
根據(jù)提示安裝即可
參考鏈接: https://github.com/castwide/vscode-solargraph/issues/78#issuecomment-535210783