Installing ruby-mysql on OS X Leopard
October 23rd, 2008By: Steven Haddox
1 Comment »
So I was receiving a lovely deprecation warning from Rails tonight that if I didn’t install the C-library mysql adapter for Ruby then my applications would stop working in my environment when Rails 2.2 is released. I decided it couldn’t be too hard to install the adapter and found out that there are a few problems with using the default gem install mysql when you are running the OS X Leopard mysql.com installation.
Anyway, the short and sweet of this is that there is a solution if your mysql gem install is giving you grief in Leopard. Simply run the following command and take note of the options in the parameter –cflags after the -I/usr/local/mysql/include directory. Those options will need to be passed in as your ARCHFLAGS value when you execute your gem install:
$ mysql_config
Usage: /usr/local/mysql/bin/mysql_config [OPTIONS]
Options:
--cflags [-I/usr/local/mysql/include -Os -arch x86_64 -fno-common]
--include [-I/usr/local/mysql/include]
--libs [-L/usr/local/mysql/lib -lmysqlclient -lz -lm]
--libs_r [-L/usr/local/mysql/lib -lmysqlclient_r -lz -lm]
--socket [/tmp/mysql.sock]
--port [3306]
--version [5.0.51b]
--libmysqld-libs [-L/usr/local/mysql/lib -lmysqld -lz -lm]
In my instance (on a Mac Pro and MacBook Pro) I was able to get ruby-mysql working with the following command:
$ sudo env ARCHFLAGS="-Os -arch x86_64 -fno-common" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config









![[del.icio.us]](http://www.stevenhaddox.com/wp-content/plugins/bookmarkify/delicious.png)
![[Digg]](http://www.stevenhaddox.com/wp-content/plugins/bookmarkify/digg.png)
![[Google]](http://www.stevenhaddox.com/wp-content/plugins/bookmarkify/google.png)
![[LinkedIn]](http://www.stevenhaddox.com/wp-content/plugins/bookmarkify/linkedin.png)
![[StumbleUpon]](http://www.stevenhaddox.com/wp-content/plugins/bookmarkify/stumbleupon.png)
![[Windows Live]](http://www.stevenhaddox.com/wp-content/plugins/bookmarkify/windowslive.png)
![[Yahoo!]](http://www.stevenhaddox.com/wp-content/plugins/bookmarkify/yahoo.png)
![[Email]](http://www.stevenhaddox.com/wp-content/plugins/bookmarkify/email.png)


![Paisley is G-l-a-m-or-ous Paisley is G-l-a-m-or-ous [ViddYou Video]](http://www.viddyou.com/get/40169.medium.jpg)
![Paisley Crawling in Full 720p HD Goodness Paisley Crawling in Full 720p HD Goodness [ViddYou Video]](http://www.viddyou.com/get/32576.medium.jpg)
![Anyone Need a Web Developer Anyone Need a Web Developer [ViddYou Video]](http://www.viddyou.com/get/29871.medium.jpg)
![Video of Steven's dilated bladder Video of Steven's dilated bladder [ViddYou Video]](http://www.viddyou.com/get/29046.medium.jpg)