3

I get this error:

Building native extensions. This could take a while...

ERROR:  Error installing mysql:
    ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb --with-mysql-config=/Applications/MAMP/Library/bin/mysql_config
checking for mysql_ssl_set()... no
checking for rb_str_set_len()... no
checking for rb_thread_start_timer()... no
checking for mysql.h... no
checking for mysql/mysql.h... 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.

I've tried everything here but I still get the error. For some reason when I run locate mysql_config this is the result I get:

/Applications/MAMP/Library/bin/mysql_config /Applications/MAMP/Library/share/man/man1/mysql_config.1

I tried running sudo gem install mysql2 -- –with-mysql config=/path/you/identified/above/mysql_config twice using each path but I still get the error from above. I downloaded a fresh version of MySql and I have Xcode, but I still get these errors. What am I doing wrong?

Community
  • 1
  • 1
Justin Meltzer
  • 13,318
  • 32
  • 117
  • 182

1 Answers1

2

Is the MAMP install the only install of mysql you have? If you've installed it from the mysql package then I think mysql_config will be installed in /usr/local/bin/mysql_config, so you might want to try:

sudo gem install mysql2 -- –with-mysql-config==/usr/local/bin/mysql_config

FYI, the /Applications/MAMP/Library/share/man/man1/mysql_config.1 path is clearly wrong. That's pointing to the man file for mysql_config not the actual executable.

Just to be certain, you did try this right? (exactly as written)

sudo gem install mysql2 -- –with-mysql-config=/Applications/MAMP/Library/bin/mysql_config

Also, I'm not sure that mysql packaged with MAMP has the header files you need. You might be best to install mysql from http://dev.mysql.com/downloads/mysql/ and then try to install your gem. In this case I think it will just work.

rainkinz
  • 10,082
  • 5
  • 45
  • 73