ruby,

Solution: gem eventmachine fatal error: 'openssl/ssl.h' file not found

Nov 05, 2021 · 1 min read · Post a comment

I’ll be doing a solution to common issues in Ruby dev environment series, so here’s the link to the first post:

Today’s solution will be related to the gem eventmachine fatal error: 'openssl/ssl.h' file not found error.

Prerequisites

  • Ruby environment

Solution

Step 1. First, make sure that the openssl package is removed.

brew uninstall openssl

Step 2. Next, remove all unused dependencies.

brew autoremove

Step 3. Reinstall openssl.

brew install openssl

Step 4. Install gem eventmachine using bundle.

bundle install

Note(s): bundle install is the preferred way, since Bundler (bundle) manages a gem set linked to an application using Gemfile. It introduces a gem version consistency while deploying a ruby app on multiple machines or environments.

Alternatively, you could try running gem install eventmachine -v ‘1.2.7’.

Conclusion

The issue happens mainly because Apple is removing the openssl package during software updates. Feel free to leave a comment below and if you find this tutorial useful, follow our official channel on Telegram.