Fix gem install msyql2 error on Mac

Bryan Siegel
April 13, 2020

So I ran into an error while trying to install the mysql2 gem. It was giving me a “ld: library not found for -lssl” error. To fix this I had to add the following to my paths so that MacOS could build the Mysql2 gem

export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/opt/openssl/lib/
export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"
export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"
export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.1/lib/pkgconfig"

Tags

mac ruby on rails Web Development

Would you like to hire me?

Side projects, Employment Opportunities, you want to give me a [big bag] of money.

Contact