Ruby, Rails, Mac, and MySQL
Posted by admin, Tue Dec 06 07:09:26 UTC 2005
Seems like everyone has a slightly different story about trying to get RoR working on a Mac with MySQL. I managed to get RoR working and connecting to an Oracle database (on another machine) from my Mac. But I wanted to get a local database working for this week, so I started playing with MySQL.
I tried working from a source distribution of MySQL (version 4.1.x), and it seemed to work when I set it up, but when I got back to it after the weekend, I could not get connected to the database server daemon. Grrr. So I uninstalled the source distro, and got the binary install of MySQL (version 5.0.x) for Mac OSX (Tiger). That install went very smoothly, including installing the startup items.
Then I tried to make it work with RoR. Not so smooth. I followed the tangle of instructions from the RoR Wiki, attempting to install/build the mysql gem to no avail. Then I found this blog. The primary difference between it and all the other advice was this one line:
<strong><strong>sudo gcc_select 4.0</strong></strong>
So I set my gcc back to 4.0, and tried to install the mysql gem again. Bingo! This time it worked. And now I have a working MySQL 5.0 development database for RoR.