Petit billet très rapide parce que j’ai pas mal galéré là-dessus. Donc autant en fait profiter.

Lorsque vous cherchez à installer le gem mysql sous mac, vous avez probablement eu de multiples erreurs de ce type :
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb install mysql
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lsocket... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lnsl... no
checking for mysql_query() in -lmysqlclient... no
*** extconf.rb failed ***

Voici ce que j’ai fait pour résoudre le problème :
sudo gem install mysql -- --with-mysql-include=/opt/local/include/mysql5 --with-mysql-lib=/opt/local/lib/mysql5 --with-mysql-config=/opt/local/lib/mysql5/bin/mysql_config
Note : j’ai mysql5 d’installé évidemment (mysql5-devel même à vrai dire).

Et du coup je saute de joie en voyant le beau

Successfully installed mysql-2.7
1 gem installed

 
Fork me on GitHub