The other day I updated to Mac OSX Lion. It broke my rails install as I had to re complie mysql. While I have got that working reinstalling the mysql2 gem has become problematic
I got this installed in the system Ruby (1.8.7 on Lion) as follows:
Add /usr/local/mysql/lib to your DYLD_LIBRARY_PATH (I prefer this to the symbolic link solution but they should be equivalent). I did this in my .bash_profile via:
export DYLD_LIBRARY_PATH="/usr/local/mysql/lib:$DYLD_LIBRARY_PATH"
Execute:
env ARCHFLAGS="-arch x86_64" sudo gem install mysql2 -- --with-mysql-dir=/usr/local/mysql --with-mysql-lib=/usr/local/mysql/lib --with-mysql-include=/usr/local/mysql/include --with-mysql-config=/usr/local/mysql/bin/mysql_config