Trouble installing mysql2 gem on OSX 10.14

I was running a bundle install on a rails application and was receiving a failure when attempting to install mysql2:

make "DESTDIR="
compiling client.c
compiling infile.c
compiling mysql2_ext.c
compiling result.c
compiling statement.c
linking shared-object mysql2/mysql2.bundle
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

make failed, exit code 2

The issue turned out to be missing headers on OSX, resolved by installing the pkg located here:

/Library/Developer/CommandLineTools/Packages/

To fix this, navigate to this location, open a finder window, and run the pkg file located there:

cd /Library/Developer/CommandLineTools/Packages/
open .

And run macOS_SDK_headers_for_macOS_10.14.pkg.

Leave a Reply

Your email address will not be published. Required fields are marked *