MySQL Gem and Rails 3.0beta4 issues

If you are running OS 10.6 (Snow Leopard) and you are having problems installing the mysql gem via bundler, there may be a simple fix.

While fooling around with bundler/macports, I was having an issue where bundler would throw an exception:

ERROR:  Error installing mysql:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
extconf.rb:10: command not found: /opt/local/bin/mysql_config5 –cflags
ERROR:  Error installing mysql:        ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rbextconf.rb:10: command not found: /opt/local/bin/mysql_config5 –cflags

It took me a good 5 minutes of tracking down the problem to find out that /opt/local/bin/mysql_config5 was a symlink to /opt/local/lib/mysql5/bin/mysql_config, and that for some reason, while the file was there and filled with delicious code, it wasn’t executable.
One sudo chmod +x later, the mysql gem installs like a charm.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.