MySQL Gem on Snow Leopard

Snow Leopard does not have the mysql gem installed, and my last solution for installing it only work in OS X prior to 10.6.4; therefore, when you see the following 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 install mysql
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h

Install the mysql gem with these steps:

  1. Download and install the latest version of MacPorts if not already installed
  2. Run the following commands to install mysql5 and the associated ruby gem

# sudo port install mysql5-server
# sudo env ARCHFLAGS="-arch x86_64" gem install mysql

One thought on “MySQL Gem on Snow Leopard”

Leave a Reply

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