I ran into the following error when trying to install MYSQL2 under gems. I was trying to install MYSQL2 to be able to import content from deeemm.com into my local jekyll dev site using the instructions posted here - https://import.jekyllrb.com/docs/joomla3/ but kept getting an ssl dependency error.

I got this error 

linking shared-object mysql2/mysql2.bundle
ld: warning: directory not found for option '-L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.Internal.sdk/usr/local/lib'
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [mysql2.bundle] Error 1
ERROR:  Error installing mysql2:
	ERROR: Failed to build gem native extension.

    current directory: /Library/Ruby/Gems/2.6.0/gems/mysql2-0.5.3/ext/mysql2 

whilst trying to install MYSQL2 like this...

gem install -V mysql2 

Oddly enough MYSQL was already installed as I have a local server set up as a development environment, but it would appear that ssl was missing. 

I ended up solving it with the following fix posted in the comments on stack exchange - https://stackoverflow.com/questions/3608287/error-installing-mysql2-failed-to-build-gem-native-extension

gem install mysql2 -v '0.5.2' -- --with-ldflags=-L/usr/local/opt/openssl/lib --with-cppflags=-I/usr/local/opt/openssl/include 

Ok, ok, I know that it's not the current version of MYSQL, but it at least allowed me to run jekyll and import the posts on to my local machine.

I tried substituting versions with 0.5.7 & 0.8.0 and they did not work, but I did find that the statement still worked if I removed the version switch altogether...

sudo gem install mysql2 -- --with-ldflags=-L/usr/local/opt/openssl/lib --with-cppflags=-I/usr/local/opt/openssl/include 

Note: the two dashes are a shorthand way of setting verbose mode '--V'

I hope this saves someone a few hours head scratching.