Sunday, November 23, 2008

Upgrading to Rails 2.2.x for Leopard

I am trying to upgrade one of my applications from the frozen rails version 2.1.1 to 2.2.2.
The steps I used:

rake rails:freeze:gems

As the mysql driver has been excluded from rails now, I thought the gem installation would be simple, but I had to find out the exact options needed and the path of the respective locations needed by those options.
As I had installed mysql with the OS X package installer, I had to use:

sudo gem install mysql -- --with-mysql-include=/usr/local/mysql/ --with-mysql-lib=/usr/local/mysql/lib --with-mysql-config=/usr/local/mysql/bin/mysql_config

I got error LoadError: dlopen(/Library/Ruby/Gems/1.8/gems/mysql-2.7/lib/mysql.bundle, 9): Library not loaded:
to fix that:

sudo install_name_tool -change /usr/local/mysql/lib/mysql/libmysqlclient.15.dylib /usr/local/mysql/lib/libmysqlclient.15.dylib /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7/lib/mysql.bundle

Then I had to fix the errors for rspec by

ruby script/plugin install git://
ruby script/plugin install git://
ruby script/generate rspec

For mysql installation done with port

sudo gem install mysql -- --with-mysql-include=/opt/local/include/mysql5/mysql/ --with-mysql-lib=/opt/local/lib/mysql5/mysql/ --with-mysql-config=/opt/local/bin/mysql_config5