mysql2 gem not installing under MacOSX 10.7.5? Try sym-linking /usr/local/mysql
2013-05-24
sym-linking /usr/local/mysql to your brew cellar might fix your mysql gem install
If you have brew installed mysql, but are unable to gem/bundle install the mysql2 gem, and see the following message:
Installing mysql2 (0.3.11)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/helmut/.rbenv/versions/1.9.3-p429/bin/ruby extconf.rb --with-mysql-config=/usr/local/mysql/bin/mysql_config
checking for rb_thread_blocking_region()... yes
checking for rb_wait_for_single_fd()... yes
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/helmut/.rbenv/versions/1.9.3-p429/bin/ruby
--with-mysql-config
extconf.rb:33:in ``': No such file or directory - /usr/local/mysql/bin/mysql_config --cflags (Errno::ENOENT)
from extconf.rb:33:in `<main>'
Gem files will remain installed in /Users/helmut/corp/sites/audrey/vendor/bundle/gems/mysql2-0.3.11 for inspection.
Results logged to /Users/helmut/corp/sites/audrey/vendor/bundle/gems/mysql2-0.3.11/ext/mysql2/gem_make.out
An error occurred while installing mysql2 (0.3.11), and Bundler cannot continue.
Make sure that `gem install mysql2 -v '0.3.11'` succeeds before bundling.
... then you might want to try to create a symbolic link from /usr/local/mysql to point to your mysql installation:
% ln -s /usr/local/Cellar/mysql/5.6.10 /usr/local/mysql