A year later, with my first MacBook Pro that ships with Ruby and Rails 2, I thought setting up RoR dev environment would be just installing MySQL.
Ha! I was wrong...
Installing MySQL 5.5 64-bit was a no brainer.
gem update --system; no problems there.
gem install mysql; ooops... this is where it fell apart.
Full mysql gem install: sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
It resulted in something like the following:
Building native extensions. This could take a while...
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.
Some attempts later, I ended up with this:
uninitialized constant MysqlCompat::MysqlRes
Turns out rails & gem still don't work well with MySQL 5.5. (note: updating mysql2.bundle with the libmysqlclient library path might work...)
So time to uninstall MySQL 5.5. Hmm... how? Found this set of instructions.
- Use mysqldump to backup your databases to text files!
- Stop the database server
- sudo rm /usr/local/mysql
- sudo rm -rf /usr/local/mysql*
- sudo rm -rf /Library/StartupItems/MySQLCOM
- sudo rm -rf /Library/PreferencePanes/My*
- edit /etc/hostconfig and remove the line MYSQLCOM=-YES-
- rm -rf ~/Library/PreferencePanes/My*
- sudo rm -rf /Library/Receipts/mysql*
- sudo rm -rf /Library/Receipts/MySQL*
However, the MySQL 5.1 installer complained that a newer version of MySQL is already installed. One more piece of MySQL to clean up.
sudo rm -rf /var/db/receipts/com.mysql.*
That got MySQL 5.1 installed. MySQL gem installed and compiled (requires Xcode).
It worked! How about that?
Coming up next, Rails 3 on MySQL 5.5. Hopefully not another year later...
1 comment:
I've also been through the pain of setting up MySQL on a Mac for developing RoR apps, twice...the last time I had the option I decided to simply use the default SQLite db for my latest Rails 3 app and because I'm using Heroku to host my app I'll have a PostgreSQL db during production. Not sure if your projects could benefit from simplifying this way, depends on your requirements...
BTW, thanks for your post on StackOverflow, http://is.gd/u3otX8, it helped me get past a problem I was having.
Cheers!
Post a Comment