Musician, Ruby on Rails Entusiast, Composer, Programmer and Lover of Hot Sauce

Installing MySQL Gem after Installing MySQL From MacPorts

Posted: May 25th, 2010 | Author: mindtonic | Filed under: Gems, MySQL | Tags: , , | No Comments »

MacPorts is a fantastic resource for installing and managing libraries on OSX. When working with Ruby on Rails, I installed MySQL (and Postgresql) using MacPorts, but had trouble getting the MySQL gem to install and connect. The error message I received was:

Error: uninitialized constant MysqlCompat::MysqlRes

Here is the magic formula:

sudo gem install -v 2.7 --no-rdoc --no-ri mysql --
--with-mysql-dir=/opt/local/lib/mysql5
--with-mysql-config=/opt/local/lib/mysql5/bin/mysql_config;

Source: http://www.ruby-forum.com/topic/192550