Forum: Ruby on Rails Advice needed --- Best way to get mysql2 gem installed to interact with Mysql Database?

216dc91a0ac0418e030ed4fc88c46218?d=identicon&s=25 dave (Guest)
on 2013-05-12 19:46
(Received via mailing list)
Hi Group,
I've got mysql database installed and the server running on a Mac Pro
latest mountain lion setup 10.8.3.
I'm able to use mysql tools like mysql, mysqladmin to converse with it.

I use RVM's scripts to fetch gems.
I've visited RVM's website but their advise to get "mysql gem loaded"
the same thing *as below aborted output*!
 I'm not sure that this website is being maintained anymore as their
copyright notice is 2011.

What/how suggestions appreciated to get this mysql2 gem installed so
that i
can use rails/ruby against this database?

My ROR config:
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin12.2.0]
Rails 3.2.12
RVM gem managed

So far Macport seems to work to install mysql and gen/install the mysql2
gem. I've not tried this gem yet as i'm still using RVM.
I don't believe this is the latest mysql release by Macport.
It goes against Mysql's website advise to install it by DMG route for
which I did with the latest stable 64 bit libraries/server.

Thanks for your help in trying to resolve this issue.

*The aborted output from gem install mysql2.*
*Both ways attempted: gem install mysql2 and with the option

gem install mysql2 --
Building native extensions.  This could take a while...
ERROR:  Error installing mysql2:
ERROR: Failed to build gem native extension.

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
*** 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:

Gem files will remain installed in
/Users/bone_david/.rvm/gems/ruby-1.9.3-p194/gems/mysql2-0.3.11 for
Results logged to

*To show mysql_config file exists:*
ls -al /usr/local/mysql/bin/mysql_config
-rwxr-xr-x  1 root  wheel  6382  5 Apr 09:53
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.