views:

246

answers:

1

So I am getting the same issue as mentioned here - http://stackoverflow.com/questions/1366746/gem-install-mysql-failure-in-snow-leopard

But I haven't been able to get it fixed using the answers on this link.

Here's a brief history -

  • I had MAMP on my machine,
  • but now I downloaded the latest MySQL from mysql.com and installed version 5.1.46
  • this new version runs fine and client "mysql" is able to connect
  • and I also have XCode v3.2.1, since someone mentioned that it can cause issues.

Here's the 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=/usr/local/mysql/bin/mysql_config
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h
Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/mysql-2.8.1 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/mysql-2.8.1/ext/mysql_api/gem_make.out**
A: 

"can't find header files for ruby" usually means that the system can't locate the header files for Ruby. This happened to me when I upgraded to 10.6 from 10.5. Download the latest XCode from Apple's site and reinstall it. Make sure that you check the box for "UNIX Development" during the install. The header files for Ruby are not in the main package.

Have you installed other versions of Ruby or are you using the standard 1.8.7 that comes with OS X? You can check your version of ruby by typing "ruby -v" at a terminal prompt.

DrMark
this is the result of...ruby -v...ruby 1.8.7 (2009-06-08 patchlevel 173) [universal-darwin10.0]I am using the version of ruby that comes with OSX 10.6.3 (i just got a new mac after the latest refresh like a month back) and installed XCode v3.2.1 on it. So really in my case it wasn't even an upgrade from a older OS to a newer one.
When you installed XCode, you must specifically install the header files. Make sure that you check the box for "UNIX Development" during the install. The header files for Ruby are not in the main package. Try doing this and it should fix your problem.
DrMark