noizZze

MySQL Gem and "Uninitialized Constant MysqlCompat::MysqlRes"

If you, like me, have upgraded to Snow Leopard and seeing the following error when trying to run your Rails app:

1
uninitialized constant MysqlCompat::MysqlRes

… here’s the quick recipe that can help:

1
2
3
$ sudo gem uninstall mysql
$ sudo -s
# export ARCHFLAGS="-arch i386 -arch x86_64" ; gem install --no-rdoc --no-ri mysql -- --with-mysql-dir=/usr/local --with-mysql-config=/usr/local/mysql/bin/mysql_config

What it does is setting the correct architecture flags along with the proper paths necessary to build native code.