Skip to content

Instantly share code, notes, and snippets.

@thbar
Created July 12, 2019 13:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thbar/c0ef22025f1b1674865729778b65ec5b to your computer and use it in GitHub Desktop.
Save thbar/c0ef22025f1b1674865729778b65ec5b to your computer and use it in GitHub Desktop.
Installing MySQL2 on Mac OS X Mojave (2019 edition)

mysql2 install failing on Mac OS X (Mojave)

If you want to install the gem (client) without having a database, doing brew install mysql-connector-c used to work, but not anymore.

You now have to install a compatible connector (mariadb):

brew install mariadb-connector-c
bundle config build.mysql2 "--with-mysql-config=$(brew info mariadb-connector-c | grep /usr/local | cut -d ' ' -f 1)/bin/mariadb_config"
bundle install

You may also have to install missing headers (see brianmario/mysql2#1045):

sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /

Related ressources:

@devstuff
Copy link

You can avoid the grep and cut by using brew --prefix:

brew install mariadb-connector-c
bundle config build.mysql2 "--with-mysql-config=$(brew --prefix mariadb-connector-c)/bin/mariadb_config"
bundle install

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