Ruby build with OpenSSL on Mac

When installing Jekyll on Mac, you can get the bellow undefined symbols error. The error signals that openssl is not installed, even though it has been installed on the machine.

4 warnings generated.
linking shared-object rubyeventmachine.bundle
Undefined symbols for architecture x86_64:
  "_SSL_get1_peer_certificate", referenced from:
      SslBox_t::GetPeerCert() in ssl.o
ld: symbol(s) not found for architecture x86_64
clang-15: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [rubyeventmachine.bundle] Error 1

The solution is to re-install Jekyll with --with-openssl-* flags , which tell ruby where it should find the library.

gem install jekyll -- --with-o
penssl-include='/usr/local/opt/openssl@3/include/openssl' --with-openssl-lib='/usr/local/opt/