我的系统是mac,然后今天在安装eventmachine的时候发现的报了错误,安装命令为:
sudo gem install eventmachine -v '1.2.7'
错误信息为:
Building native extensions. This could take a while...
ERROR: Error installing eventmachine:
ERROR: Failed to build gem native extension.
current directory: /Library/Ruby/Gems/2.3.0/gems/eventmachine-1.2.7/ext
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -r ./siteconf20190123-26894-gknmbc.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/eventmachine-1.2.7 for inspection.
Results logged to /Library/Ruby/Gems/2.3.0/extensions/universal-darwin-18/2.3.0/eventmachine-1.2.7/gem_make.out
解决方式:
xcode-select --install
然后成功安装:
EtCampusDoc git:(master) sudo gem install eventmachine -v '1.2.7'
Building native extensions. This could take a while...
Successfully installed eventmachine-1.2.7
Parsing documentation for eventmachine-1.2.7
Installing ri documentation for eventmachine-1.2.7
Done installing documentation for eventmachine after 6 seconds
1 gem installed
[1]. Fail to Building native extensions. on Mac OSX 10.13.6. https://github.com/castwide/vscode-solargraph/issues/78