Jan 16 2009

Installing Rails 2.2 on OSX Leopard

In my few spare moments, I like to hack Ruby on Rails. Non programmers are free to tune out at this point.

I recently tried to install and configure the recently released Rails 2.2. Among the changes therein, the MySQL driver is no longer included – you need to install the mysql gem.

The standard gem installation did not work:

$ sudo gem install mysql
Building native extensions.  This could take a while...
ERROR:  Error installing mysql:
	ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb install mysql

After a bit of googling, it turns out you need to give a bit more information for this gem:

$ sudo bash -c "ARCHFLAGS='-arch i386' gem install mysql -- \
	--with-mysql-config=/usr/local/mysql/bin/mysql_config"
Building native extensions.  This could take a while...
Successfully installed mysql-2.7
1 gem installed

While this installed the gem, it still did not fix the problem:

!!! The bundled mysql.rb driver has been removed from Rails 2.2.
Please install the mysql gem and try again: gem install mysql.
rake aborted!
dlopen(/Library/Ruby/Gems/1.8/gems/mysql-2.7/lib/mysql.bundle, 9):
  Library not loaded: /usr/local/mysql/lib/mysql/libmysqlclient.15.dylib
  Referenced from: /Library/Ruby/Gems/1.8/gems/mysql-2.7/lib/mysql.bundle
  Reason: image not found - /Library/Ruby/Gems/1.8/gems/mysql-2.7/lib/mysql.bundle

Some further googling later, it transpires that you need to muck about with the dynamic link libraries:

$ sudo install_name_tool -change /usr/local/mysql/lib/mysql/libmysqlclient.15.dylib \
	/usr/local/mysql/lib/libmysqlclient.15.dylib \
	/Library/Ruby/Gems/1.8/gems/mysql-2.7/mysql.bundle 
$ sudo install_name_tool -change /usr/local/mysql/lib/mysql/libmysqlclient.15.dylib \
	/usr/local/mysql/libmysqlclient.15.dylib \
	/Library/Ruby/Gems/1.8/gems/mysql-2.7/lib/mysql.bundle

These last two commands look very similar, but there’s a subtle difference between them: there are two different paths to separate instances of the libmysqlclient.15.dylib file.

And low and behold:

$ irb
>> require 'mysql'
=> true

And there was great rejoicing. Note that this solution is specific to Mac OSX Leopard. It will work for Tiger, apparently, but you need to change some of the paths in the last two commands.

We will now return you to your regular programming.

Related Posts:

  • No Related Posts

Jan 14 2009

Fionn blogs

My boss, Prof. Fionn Murtagh has just set up his own blog.  That’s two of us now, as far as I know, and hopefully more to follow.

Related Posts:


Jan 12 2009

PRTLI 5 announced

This has been a long time coming.

Related Posts:


Jan 8 2009

Black news in Limerick


As expected, Dell have announced that they are to make massive layoffs in their Limerick plant: 1,900 out of 3,000 jobs will go over the next 12 months.  Given the general economic outlook at present, this is undoubtedly going to mean difficult times for many families in the Limerick area over the next few years.

If one were to look for a bright spot on the horizon, we might consider that when Digital Equipment pulled out of Galway in 1993 with the loss of many jobs, it was seen at the time as an absolute calamity.  Time has shown, however, that instead it acted as the catalyst for the creation of a raft of independent IT engineering companies started up by the former DEC engineers.

We must work to ensure that a similar outcome will arise in Limerick in the coming years.

Related Posts:

  • No Related Posts

Jan 8 2009

Fowler on academic rotation

Martin Fowler has just posted an excellent article on Academic Rotation, where he sets out the dichotomy that has arisen between how success is measured in academic circles versus commercial circles.

When describing the reaction he received to his advice to a post-doc to spend some time in industry to understand what software development problems require research he says:

His answer to this thought was very troubling. He said he’d be up to do that, but if he spent time in industry that would ruin his chances of getting a job in academia. Competition for academic jobs is high, and what they look it is your publication history. A year or two in industry would create a gap in your publication history that would be lethal to your job prospects.

Clearly,this is a real problem for academia in general, and in particular for a small country like Ireland that is striving to create an innovation culture through scientific and engineering research.

Fowler’s suggestion of rotation is an excellent one, but we probably need more.  We need to ensure that industrial experience is seen as at least as a strength, indeed maybe even a pre-requisite, when considering academic appointments.

Related Posts: