環境
- Mac El Capitan
Gemfileに
症状
gem install eventmachine
ができない
gem "eventmachine"
でbundle instrallすると
Using ref 1.0.5 Using sass 3.2.14 Using simple_oauth 0.3.0 Using elasticsearch-api 1.0.1 Using thread_safe 0.2.0 Using airbrake 4.0.0 Using rack-test 0.6.2 Using treetop 1.4.15 Using rspec-core 3.1.7 Using rspec-mocks 3.1.3 Using rspec-expectations 3.1.2 Using better_errors 2.0.0 Using net-scp 1.2.1 Using whenever 0.9.4 Using coffee-script 2.2.0 Using unf 0.1.4 Using faraday 0.9.0 Gem::Ext::BuildError: ERROR: Failed to build gem native extension. /Users/thr3a/.rbenv/versions/2.2.4/bin/ruby -r ./siteconf20170322-53700-z08h1b.rb extconf.rb checking for rb_trap_immediate in ruby.h,rubysig.h... no checking for rb_thread_blocking_region()... no checking for ruby/thread.h... yes checking for rb_thread_call_without_gvl() in ruby/thread.h... yes checking for inotify_init() in sys/inotify.h... no checking for __NR_inotify_init in sys/syscall.h... no checking for writev() in sys/uio.h... yes checking for rb_thread_fd_select()... yes checking for rb_fdset_t in ruby/intern.h... yes checking for rb_wait_for_single_fd()... yes checking for rb_enable_interrupt()... no checking for rb_time_new()... yes checking for sys/event.h... yes checking for sys/queue.h... yes checking for clock_gettime()... no checking for gethrtime()... no creating Makefile make "DESTDIR=" clean make "DESTDIR=" compiling binder.cpp In file included from binder.cpp:20: ./project.h:116:10: fatal error: 'openssl/ssl.h' file not found #include <openssl/ssl.h> ^ 1 error generated. make: *** [binder.o] Error 1 make failed, exit code 2
と怒られる
対処法
gem install eventmachine -- --with-cppflags=-I/usr/local/opt/openssl/include
Gemfile.lockのバージョンに合わせてインストールするには
gem install eventmachine -v "1.0.7" -- --with-cppflags=-I/usr/local/opt/openssl/include
でいける