Running Rails and MySQL on OS X 10.4 (Tiger)
|Working through the "Depot" example in the widely praised book "Agile Web Development with Rails", I encountered a well known problem with Ruby and MySQL on OS X 10.4 (Tiger), identified in the footnotes of the book on p. 53:|
"Unless, perhaps, you’re running OS X 10.4. It seems as if Tiger has broken Ruby’s
standard MySQL library. If you see the error 'Before updating scaffolding from new DB schema, try creating a table for your model (Product)', it may well be because Ruby (and hence Rails) can’t get to the database. To fix Apple’s bad install, you’re going to need to reinstall Ruby’s MySQL library, which means running the script on page 21 to repair the Ruby installation, and then reinstalling the mysql gem."
The book's advice did not work for me. But Tony Arnold's advice did work. I needed to install the Xcode Tools from the OS X 10.4 Developer Tools CD. This provides the GCC 4.0 "C" compiler needed to build a working Ruby MySQL binding from source.
My working configuration:
MacOS X 10.4.2
ruby 1.8.2 (2004-12-25) [powerpc-darwin8.0]
Rails 0.14.3 (updated from Tony Arnold's Rails distribution for OS X Tiger)
mysql-ruby-2.7 binding compiled from source using GCC 4.0
I converged on Tony Arnold's information only after wading through much other material surfaced through Web searches. The information on the RubyOnRails site covering this same topic struck me as more complex to digest. I can not confirm whether that material works, but the commentary reveals some confusion among developers. Hopefully, recording my successful experience here will save others some time.