Mysql Gem for OSX Lepard Ruby

This post has already been read 5280 times!

ruby_img.jpgWant to build the mysql gem for the system’s Ruby and use the mysql binary you just installed from mysql.org?

Easy, has wonko.com has the answer and it worked perfectly! I love Google.

airbot:~ [504]$ sudo env ARCHFLAGS="-arch i386" gem install mysql -- \
>   --with-mysql-dir=/usr/local/mysql --with-mysql-lib=/usr/local/mysql/lib \
>   --with-mysql-include=/usr/local/mysql/include
Password:
Bulk updating Gem source index for: http://gems.rubyforge.org
Building native extensions.  This could take a while...
Successfully installed mysql-2.7
1 gem installed

And your off…..

Update: don’t forget to add the gems require at the top of your ruby scripts:

require 'rubygems'

This will get rid of the

in `require': no such file to load -- mysql (LoadError)

errors. On my linux machine, mysql was not installed as a gem so I didn’t have the require in my scripts.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.