Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Ruby

Msql2 gem

I'm having trouble getting started on the ActiveRecords Basics lesson. I'm getting this error when I run bundle for the active records project. I'm not sure how to configure the mysql2 gem. Any suggestions?

http://cl.ly/image/2u0J3h1I3x15

8 Answers

Jason Seifer
STAFF
Jason Seifer
Treehouse Guest Teacher

Hey Zach Hodder what operating system are you using -- are you on a Mac, Windows, or linux computer? Can you try doing the following also and paste the output here:

gem install mysql2

Hi Jason,

Thanks for reaching out. I'm on a Mac running os x 10.9.3. Here's the output after I try to install the gem:

Zachs-MacBook-Pro:biller zholdren$ gem install mysql2 Building native extensions. This could take a while... ERROR: Error installing mysql2: ERROR: Failed to build gem native extension.

/Users/zholdren/.rbenv/versions/2.1.2/bin/ruby extconf.rb

checking for ruby/thread.h... yes checking for rb_thread_call_without_gvl() in ruby/thread.h... yes checking for rb_thread_blocking_region()... yes checking for rb_wait_for_single_fd()... yes checking for rb_hash_dup()... yes checking for rb_intern3()... yes checking for mysql_query() in -lmysqlclient... no checking for main() in -lm... yes checking for mysql_query() in -lmysqlclient... no checking for main() in -lz... yes checking for mysql_query() in -lmysqlclient... no checking for main() in -lsocket... no checking for mysql_query() in -lmysqlclient... no checking for main() in -lnsl... no checking for mysql_query() in -lmysqlclient... no checking for main() in -lmygcc... no checking for mysql_query() in -lmysqlclient... no *** 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/zholdren/.rbenv/versions/2.1.2/bin/ruby --with-mysql-dir --without-mysql-dir --with-mysql-include --without-mysql-include=${mysql-dir}/include --with-mysql-lib --without-mysql-lib=${mysql-dir}/lib --with-mysql-config --without-mysql-config --with-mysql-dir --without-mysql-dir --with-mysql-include --without-mysql-include=${mysql-dir}/include --with-mysql-lib --without-mysql-lib=${mysql-dir}/lib --with-mysqlclientlib --without-mysqlclientlib --with-mlib --without-mlib --with-mysqlclientlib --without-mysqlclientlib --with-zlib --without-zlib --with-mysqlclientlib --without-mysqlclientlib --with-socketlib --without-socketlib --with-mysqlclientlib --without-mysqlclientlib --with-nsllib --without-nsllib --with-mysqlclientlib --without-mysqlclientlib --with-mygcclib --without-mygcclib --with-mysqlclientlib --without-mysqlclientlib

extconf failed, exit code 1

Gem files will remain installed in /Users/zholdren/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/mysql2-0.3.16 for inspection. Results logged to /Users/zholdren/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/extensions/x86_64-darwin-13/2.1.0-static/mysql2-0.3.16/gem_make.out

Yep. This is what I get when I check the version.

/Applications/MAMP/Library/bin/mysql Ver 14.14 Distrib 5.5.25, for osx10.6 (i386) using EditLine wrapper

I did receive this output: -bash: type: mysql: not found

when I tried looking for the location: type -a mysql

Jason Seifer
STAFF
Jason Seifer
Treehouse Guest Teacher

I think MAMP is going to be the issue here. Try following along with these instructions and see if that helps.

Hi Jason,

It looks like this is the solution. However, I'm running into (no such file or directory) when I try to run step 11. Any suggestions?

https://www.dropbox.com/s/d1iyykhmif0n7i8/Screenshot%202014-07-14%2020.24.56.png