Fix eventmachine gem install error on OS X

In Ruby, eventmachine is a common gem containing an event-processing library. While most gems are written in Ruby, this one has bits that need to be compiled during installation. That’s why we call it a “native gem.”

Some people reported problems installing eventmachine in OS X. Fortunately, the fix is simple. There are two things to try when that gem cannot be compiled and installed:

  1. If it’s bundled in a Gemfile, update the gem itself:
    $ bundle update eventmachine
    
  2. If the above didn’t help, tell Bundler which OpenSSL library to use when compiling the gem:
    $ bundle config build.eventmachine --with-cppflags=-I/usr/local/opt/openssl/include
    $ bundle install
    

This should help you install eventmachine.