So if you have ever run into failing to install mysql2
gem with bundler, here is a quick way to resolve it:
- Install MySQL with dev headers
- Configure bundler
mysql2.build
option: bundle config build.mysql2 --with-mysql-dir=<path_to_mysql_folder>
bundle install
If you run into issue like this (which is likely if your MySQL does not get installed into /usr/local/mysql on macOS)
/Users/tle/.asdf/installs/ruby/2.3.5/lib/ruby/gems/2.3.0/gems/mysql2-0.5.2/lib/mysql2.rb:33:in `require':LoadError: dlopen(/Users/tle/.asdf/installs/ruby/2.3.5/lib/ruby/gems/2.3.0/gems/mysql2-0.5.2/lib/mysql2/mysql2.bundle, 9): Library not loaded: /usr/local/mysql/lib/libmysqlclient.20.dylib