Install ruby-mysql on Mac OS X 10.4 Tiger
You probably know that the built-in mysql code in Rails sucks. To rephrase that, the ruby-mysql gem contains better code, so you want that. Rails automatically detects if you have ruby-mysql installed or not, and uses it if you have it.
Most notably, you want to install this gem if you get dropped MySQL connections running your Rails application.
So we do:
$ sudo gem install mysql ... ERROR: Failed to build gem native extension.
Normall this would install fine, but not on Mac OS X. This is because Mac OS X keeps its code, headers and libraries in odd places (compared to Linux). But don’t panic. There’s an easy solution to all this!
Just compile the gem yourself, and add some special ingredients. Well, not even that. Just compile it again like this:
$ cd /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7 $ sudo ruby extconf.rb --with-mysql-lib=/usr/local/mysql/lib --with-mysql-include=/usr/local/mysql/include $ sudo make $ sudo make install
Now, you have the ruby-mysql gem installed and ready to go! No more dropped MySQL connections for Rails!