Installing mysql2
gem errors on MacOS Catalina with MySQL 5.7.
Make sure openssl
is installed on Mac via Homebrew.
brew install openssl
Install mysql2
gem.
gem install mysql2 -v '0.5.3' -- --with-mysql-config=$(brew --prefix [email protected])/bin/mysql_config --with-ldflags=-L/usr/local/opt/openssl/lib --with-cppflags=-I/usr/local/opt/openssl/include
If you want to bundle
mysql2
you need to set these flags viabundle config
:bundle config build.mysql2 --with-opt-dir=$(brew --prefix openssl)
On my Mac OS Catalina (with MySQL 8) setting
--with-cppflags
generated this error:Credit to this comment.