Install gem eventmachine 1.2.7 with ssl on m1

3.6k Views Asked by At

I'm posting this in case anyone else has the same issue. I was trying to deploy my ruby project from and apple m1 laptop and was getting libc++abi: terminating with uncaught exception of type std::runtime_error: Encryption not available on this event-machine .

Checking eventmachine gave

ruby -reventmachine -ve "puts EM.library_type, EM.ssl?"                     
ruby 2.6.7p197 (2021-04-05 revision 67941) [arm64-darwin20]
extension
false

Tried an uninstall and install on eventmachine to no avail.

3

There are 3 best solutions below

1
Chrissy H On

Searched for where openssl was installed and then uninstalled and reinstalled with

gem install eventmachine -v '1.2.7' -- --with-cppflags=-I/Users/chris/.rbenv/versions/2.6.7/openssl/include

Then had

ruby -reventmachine -ve "puts EM.library_type, EM.ssl?"                                                    
ruby 2.6.7p197 (2021-04-05 revision 67941) [arm64-darwin20]
extension
true
0
Pandaiolo On

@Chrissy H answer did not work on my M1 Mac, but the following did (by recompiling native extensions)

PKG_CONFIG_PATH="$(brew --prefix openssl)/lib/pkgconfig" \
   gem install eventmachine 

Note that I' musing openssl v1 and needed a specific version, maybe that is why, anyway my full command was:

PKG_CONFIG_PATH="$(brew --prefix [email protected])/lib/pkgconfig" \ 
   gem install eventmachine -v '1.0.9.1'
0
Patrick Y On

This worked for me:

gem install eventmachine -v '1.2.7' -- --with-ldflags="-Wl,-undefined,dynamic_lookup"