Hello, I’m a web craftsman with a passion for the modern web. I build web applications and play with social services and communities.

August 5, 2010 at 5:12 pm

When running rake tasks (that are related to the database) in Rails apps I ran into the following error a couple of times on different OS X Snow Leopard machines:

uninitialized constant MysqlCompat::MysqlRes

The mysql gem is installed but got compiled for a wrong architecture for some reason. I’m not 100% sure when this happens but if you run into the problem uninstall the mysql gem

$ sudo gem uninstall mysql

and reinstall it with this flag

$ sudo env ARCHFLAGS="-arch x86_64" gem install mysql

if you are using rvm you can skip the “sudo” on all commands.