I always get an error when running bundle install with this gem added to the Gemfile.
gem "mysql2", "0.3.11"
The error looks like this:
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. /Users/fousa/.rvm/rubies/ruby-1.9.2-p320/bin/ruby extconf.rb checking for rb_thread_blocking_region()... yes checking for rb_wait_for_single_fd()... no ... An error occurred while installing mysql2 (0.2.18), and Bundler cannot continue. Make sure that `gem install mysql2 -v '0.2.18'` succeeds before bundling.
But running gem install mysql2 -v '0.2.18' doesn't seem to work... Well, the following command does, just add some homebrew parameters.
gem install mysql2 -v '0.2.18' -- --with-mysql-lib=/usr/local/Cellar/mysql/5.5.19/lib --with-mysql-dir=/usr/local/Cellar/mysql/5.5.19 --with-mysql-config=/usr/local/Cellar/mysql/5.5.19/bin/mysql_config --with-mysql-include=/usr/local/Cellar/mysql/5.5.19/include
Don't forget to pass the correct Homebrew directories.