# \[mysql gem\] Failed to lookup Init function

**URL:** <https://www.ruby-forum.com/t/mysql-gem-failed-to-lookup-init-function/151733>\
**Category:** Rails\
**Created:** [October 24, 2008, 10:06pm UTC](https://www.ruby-forum.com/t/mysql-gem-failed-to-lookup-init-function/151733 "2008-10-24T22:06:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tejo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/8797f3/32.png) [@tejo](https://www.ruby-forum.com/u/tejo)\
**Post date:** [October 24, 2008, 10:06pm UTC](https://www.ruby-forum.com/t/mysql-gem-failed-to-lookup-init-function/151733/1 "2008-10-24T22:06:56Z")

</div>

Hi, with mysql.rb removed from rails 2.2 I need to install the mysql  
gem

I have mac osx 10.5.5

I have mysql installed in /usr/local/mysql, so, after a bunch of try,  
I’ve installed  
the gem with:

env ARCHFLAGS="-arch i386" gem install mysql – --with-mysql-config=/  
usr/local/mysql/bin/mysql\_config

the gem seems installed in /usr/local/lib/ruby/gems/1.8/gems/  
mysql-2.7/

but when I try to fire up a command than involves mysql e.g.: rake  
db:create I get this error:

LoadError: Failed to lookup Init function /usr/local/lib/ruby/gems/1.8/  
gems/mysql-2.7/lib/mysql.bundle  
from /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7/lib/mysql.bundle

I also tried with:

env ARCHFLAGS="-arch i386" gem install mysql – --with-mysql-include=/  
usr/local/mysql/include --with-mysql-lib=/usr/local/mysql/lib --with-  
mysql-dir=/usr/local/mysql --with-mysql-config=/usr/local/mysql/bin/  
mysql\_config

and many other ways, but still get the same error.

Any ideas?

Thanks

---

<div class="post-metadata">

**Author:** ![tejo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/8797f3/32.png) [@tejo](https://www.ruby-forum.com/u/tejo)\
**Post date:** [October 25, 2008, 3:37pm UTC](https://www.ruby-forum.com/t/mysql-gem-failed-to-lookup-init-function/151733/2 "2008-10-25T15:37:04Z")

</div>

UPDATE:

After a load of pain and suffer i solved Installing mysql5 client from  
port

sudo port install mysql5

and re-installing the mysql gem with this options:

sudo env ARCHFLAGS="-arch i386" 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

Hope this can help somebody to save some hours of googoling.
