Install mysql2 ruby gem under OS X 10.8 Mountain Lion - Ruby + MacPorts
I stumbled into the following problem:
Installing mysql2 (0.3.11) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/gergely/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
checking for rb_thread_blocking_region()... yes
checking for rb_wait_for_single_fd()... yes
checking for mysql.h... no
checking for mysql/mysql.h... no
-----
mysql.h is missing. please check your installation of mysql and try again.
-----
*** 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.
First, install MySQL via MacPorts:
sudo port install mysql55 mysql55-server
Then install the MySQL gem with proper configuration:
sudo gem install mysql2 -- --with-mysql-config=/opt/local/lib/mysql55/bin/mysql_config
Result:
Building native extensions. This could take a while...
Successfully installed mysql2-0.3.11
1 gem installed
Installing ri documentation for mysql2-0.3.11...
Installing RDoc documentation for mysql2-0.3.11...
Win!
Written by Gergely Tamás Kurucz
Related protips
1 Response
Really helpful, thanks!
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#