For MacOS Catalina, visit Install mysql2 on MacOS Catalina
Installing mysql2
gem errors on MacOS Mojave.
Make sure openssl
is installed on Mac via Homebrew.
brew install openssl
Install mysql2
gem.
gem install mysql2 -v '0.5.2' -- --with-ldflags=-L/usr/local/opt/openssl/lib --with-cppflags=-I/usr/local/opt/openssl/include
Tried all of the solutions from multiple sources/websites and the only one that worked on a M2 2023 was
gem install mysql2 -v '0.3.18' -- --srcdir=/opt/homebrew/Cellar/mysql/8.0.33_2/include
. Other solutions were working for more recent versions of the mysql2 gem though.