Skip to content

Instantly share code, notes, and snippets.

@fernandoaleman
Last active July 11, 2023 02:11
Show Gist options
  • Star 12 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
  • Save fernandoaleman/12698634824f5d5c00ab57b72ee2ad52 to your computer and use it in GitHub Desktop.
Save fernandoaleman/12698634824f5d5c00ab57b72ee2ad52 to your computer and use it in GitHub Desktop.
Install mysql2 on MacOS Catalina

Problem

Installing mysql2 gem errors on MacOS Catalina with MySQL 5.7.

Solution

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 mysql@5.7)/bin/mysql_config --with-ldflags=-L/usr/local/opt/openssl/lib --with-cppflags=-I/usr/local/opt/openssl/include
@chandimaj1
Copy link

I've tried your different git for Mojave and worked for me:
gem install mysql2 -v '0.5.2' -- --with-ldflags=-L/usr/local/opt/openssl/lib --with-cppflags=-I/usr/local/opt/openssl/include

worked for me as well . been searching the internet for over 4 hours. MacOs Big Sur 11.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment