So I decided to upgrade to Snow Leopard last week in order to use the iOS SDK and crank out some iPhone/iPad apps. As with any major upgrade I was expecting a few minor problems, but it really wreaked havoc on my Rails development environment. The first problem was with MySQL. The previously installed version did not work at all after the upgrade. I could not get the server to start. I downloaded the newest DMG of mysql server and installed it on my Mac. I chose 32 bit MySQL, since I mistakenly thought my Mac was 32 bit after I ran the “uname -a” command and it showed i386. So after some experimenting and further research, I downloaded the 64 bit DMG, since my Mac is actually 64 bit capable (if your processor info says Intel Core 2 Duo, then you are 64 bit). In order to keep my existing data from the crapped out MySQL server (prior install for Mac 10.5), I had to stop the running server, delete the contents of the mysql data directory, copy my old data from the old data dir, and restart the server. This fixed my database problems. The next odd thing was my C Compiler. I tried to install the mysql gem and received this error:
Building native extensions. This could take a while…
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.
checking for mysql_query() in -lmysqlclient… /Users/me/.rvm/rubies/ruby-1.9.2-rc2/lib/ruby/1.9.1/mkmf.rb:368:in `try_do’: The complier failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /Users/me/.rvm/rubies/ruby-1.9.2-rc2/lib/ruby/1.9.1/mkmf.rb:435:in `try_link0′
Looking at the mkmf.log, showed me that it was having problems with the readline library. Apparently the system readline installed with Snow Leopard does not play well with the ruby install. So I ran the following and RVM was able to use the correct readline library:
rvm package install readline rvm install 1.9.2 -C --with-readline-dir=$HOME/.rvm/usr
This solved the readline problem, but another problem appeared after this:
ld: in /usr/local/lib/libxml2.2.dylib, file was built for i386 which is not the architecture being linked (x86_64)
There were are also problems with SQLite and libxslt. I found this post which solved all 3 of these problems. Thanks Mark!
After correcting these problems, Ruby 1.9.2 installed fine with RVM and I was able to install the mysql gem without errors.