Recently when working with a new gemset in RVM, I noticed that the gem install of mysql-0.10.7, the C extensions be exact, did not link correctly against the mysqllibclient dynamic library. I don't really know why this at this point. I needed to get it fixed. Stackoverflow to the rescue, but I wanted to post the script I made to make this easier.
The error when running my Sinatra app:
The ruby script for the fix:
#!/bin/env ruby
mysql_bundle = `find ~ -name do_mysql.bundle`
mysql_lib = 'libmysqlclient.18.dylib'
mysql_lib_location = `find /usr/local -name #{mysql_lib}`
m_array = mysql_lib_location.split
mysql_lib_path = m_array.first if m_array
mysql_bundle.split.each do |bundle|
`/usr/bin/install_name_tool -change #{mysql_lib} #{mysql_lib_path} #{bundle}`
end