I have not been able to put this post up for quite some time now. Actually this has to do with mysql gem installation issue on Mac OSX 10.6 (or later). Initially there were issues with mysql gem installationl. Once it got installed and I ran my app, I got the not so famous “uninitialized constant MysqlCompat::MysqlRes”. I researched and found the solution.
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
This worked for me when I was getting the “uninitialized constant MysqlCompat::MysqlRes” error:
It basically happens when ruby installed is of 64 bit and mysql is of 32 bit.
First uninstall all mysql gems.
Uninstall the 32 bit old mysql directory .. in my case, it was at /usr/local/mysql
Then get 64 bit mysql dmg, install and reboot to leave no chance for error.
Then use the following command to install the 64 bit version of mysql gem.
export ARCHFLAGS="-arch i386 -arch x86_64" ; gem install --no-rdoc --no-ri mysql -- --with-mysql-dir=/usr/local/mysql --with-mysql-config=/usr/local/mysql/bin/mysql_config