Skip to content

Instantly share code, notes, and snippets.

@yuhonas
Last active April 12, 2018 00:32
Show Gist options
  • Save yuhonas/bff797bac44b8908f61ce24e6f48adee to your computer and use it in GitHub Desktop.
Save yuhonas/bff797bac44b8908f61ce24e6f48adee to your computer and use it in GitHub Desktop.
Failed to build gem native extension error when installing the mysql2 ruby gem on mac with brew installed mysql
# ensure we have xcode commandline tools installed as we'll be compiling
xcode-select --install
# we can either install the gem manually eg.
# where '0.3.21' is the version of the gem you wish to install
#
# gem install mysql2 -v '0.3.21' -- \
# --with-mysql-config=$(brew --prefix mysql)/bin/mysql_config
# or configure bundler then all future mysql2 gem installation's will use the additional args
bundle config build.mysql2 --with-mysql-config=$(brew --prefix mysql)/bin/mysql_config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment