MySQL Ruby Gem Frustration with OS X

A few minutes ago I posted about the time I’d wasted since inadvertently upgrading my ruby version.

My last hurdle was to install the mysql ruby gem, which is never easy on OS X, as I learned the first time around a few days ago.

However this time, I was stumped. The gem seemed to build OK, but would simply not appear in gem list. Finally, I found this miraculous post.

So for those who aren’t up to speed, the solution (which worked for me) is to patch your mysql installation (as opposed to the gem) so that the gem will build, then do some ‘morse-codish crap’ with the gem install command… here we go:

sudo edit /usr/local/mysql/include/mysql.h

Add the line

#define ulong unsigned long


Now your local mysql install will be happy to build the gem.

sudo gem install mysql -- --with-mysql-dir=/usr/local/mysql

Note the double-double-dash shenanigans.

Published by Matt

I write software, and love learning how to do it even better.

Leave a comment

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