website stat

Ruby on Rails on track with MySQL 4.1

Actually, it seems that not everything went fine. Ruby on Rails’ default mysql driver is broke on Mac OS X (while connecting to MySQL >= 4.1) meaning that it was not able to connect to the database.

Fortunately there’s always a guy who had the problem first. Which means that you won’t need to waste as much time as he did ;-) Normally, you’ll just have to do sudo gem install mysql which means you must have Ruby Gems installed. But if you’re into serious RR development you have it by now.Actually this may not be enough depending on how you did install MySQL client on your machine. This did the trick on my machine:

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

If still you can’t compile the driver, here are another tips that, although I didn’t need them, they may come in handy to you. First, install the fixed rbconfig file:

sudo gem install fixrbconfig; sudo fixrbconfig

You can also try changing your gcc environment to 3.3 instead of 4.0.

sudo gcc_select 3.3

will do the trick. Remember to revert it back afterwards.


No Responses to “Ruby on Rails on track with MySQL 4.1”

Comments are closed.