Ruby MySQL gem install problems solved

I noticed an error in my rails log today that said:

"WARNING: You're using the Ruby-based MySQL library that ships with Rails. This library is not suited for production. Please install the C-based MySQL library instead (gem install mysql)."

Unfortunately, when I went to install the gem I got an error going something like this:

Failed to build native gem extension ... extconf.rb failed Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers.

I am using the MacPorts install of MySQL. It took a little leg work but I found a post that led me to use the following command, which installed the gem on my Intel Mac successfully.

sudo env ARCHFLAGS="-arch i386" gem install mysql -- --with-mysql-config=/opt/local/lib/mysql5/bin/mysql_config