# Installing mysql2 Gem on OSX when Headers Can't Be Found

DevFeed: [Installing mysql2 Gem on OSX when Headers Can't Be Found](<https://devfeed.tech/articles/installing-mysql2-gem-on-osx-when-headers-can-t-be-found-28247.md>)

Original publisher: [Read original article](<http://fuzzyblog.io/blog/rails/2019/11/21/installing-mysql2-gem-on-osx-when-headers-can-t-be-found.html>)

Author: Fuzzygroup

Published: 2019-11-21T00:00:00Z

Content type: tutorial

Language: en

Sources: [Scott Johnson](<https://devfeed.tech/sources/scott-johnson.md>)

Topics: [Rails](<https://devfeed.tech/topics/rails.md>), [MySQL](<https://devfeed.tech/topics/mysql.md>), [osx](<https://devfeed.tech/topics/osx.md>), [Ruby](<https://devfeed.tech/topics/ruby.md>), [SSL](<https://devfeed.tech/topics/ssl.md>)

Tags: [mysql](<https://devfeed.tech/tags/mysql.md>), [osx](<https://devfeed.tech/tags/osx.md>), [rails](<https://devfeed.tech/tags/rails.md>), [ruby](<https://devfeed.tech/tags/ruby.md>), [ssl](<https://devfeed.tech/tags/ssl.md>)

## AI overview

A troubleshooting guide for installing the mysql2 Ruby gem on OS X when bundle install fails because the build process cannot find OpenSSL libraries or headers. It discusses the reported linker error and the role of MariaDB and system-specific build environments.

## Source excerpt

Note: If you're not a Rails user, on OSX, then just nope the heck out of reading this post. This is some serious nerdery here. One of the single most frustrating things about the Rails ecosystem is when you can't get a bundle install operation to finish. The bundle install, of course, is the process of getting the software tools, "gems", identified in Gemfile to install. When you can't get bundle install to finish, you are effectively entirely blocked from continuing with a project. A friend hit a serious problem recently with bundle install and the mysql2 gem. I gave some online help via chat and while they solved it without me, I volunteered to write it down so there's a decent explanation / write up. Here's the error: ld: library not found for -lssl clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [mysql2.bundle] Error 1 My first suggestion was to try a "brew install mariadb" (mariadb is a fully compatible, better version of MySQL, written by the creator of MySQL). It turned out that mariadb was already installed. So this led me to this blink and then I asked for "paste me the whole disgustingly long error message on bundle install". Installing mysql2 0.5.2 with native extensions Gem::Ext::BuildError: ERROR: Failed to build gem native extension. current directory: /Users/foo/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/mysql2-0.5.2/ext/mysql2 /Users/foo/.rbenv/versions/2.6.3/bin/ruby -I /Users/foo/.rbenv/versions/2.6.3/lib/ruby/2.6.0 -r ./siteconf20191120-7300-1a2t7xt.rb extconf.rb checking for rb_absint_size()... yes checking for rb_absint_singlebit_p()... yes checking for rb_wait_for_single_fd()... yes ----- Using mysql_config at /usr/local/bin/mysql_config ----- checking for mysql.h... yes checking for errmsg.h... yes checking for SSL_MODE_DISABLED in mysql.h... no checking for MYSQL_OPT_SSL_ENFORCE in mysql.h... yes checking for MYSQL.net.vio in mysql.h... no checking for MYSQL.net.pvio in mysql.h... yes checking for