Issue with eventmachine install El Capitan and macOS Sierra

Today when I was installing a new project on my machine I got the error below:

gem install eventmachine -v ‘1.0.4’
Building native extensions. This could take a while…
ERROR: Error installing eventmachine:
ERROR: Failed to build gem native extension.
/Users/matthewbarram/.rbenv/versions/2.1.4/bin/ruby extconf.rb
checking for rb_trap_immediate in ruby.h,rubysig.h… no
checking for rb_thread_blocking_region()… yes
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_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
creating Makefile
make “DESTDIR=” clean
make “DESTDIR=”
compiling binder.cpp
In file included from binder.cpp:20:
./project.h:112: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 files will remain installed in /Users/matthewbarram/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/eventmachine-1.0.4 for inspection.
Results logged to /Users/matthewbarram/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/extensions/x86_64-darwin-15/2.1.0-static/eventmachine-1.0.4/gem_make.out

The fix as per this post was to reinstall with this flag:

gem install eventmachine -v '1.0.4' — — with-cppflags=-I/usr/local/opt/openssl/include 

This worked!

UPDATE: 17 January 2017 → The previously mentioned fix does not appear to work but the updated command:

PKG_CONFIG_PATH=”$(brew — prefix openssl)/lib/pkgconfig” gem install eventmachine -v '1.0.4'

I also reinstalled OpenSSL with Brew before running this.