# Ruby can't open library: /Library/MySQL/lib/mysql/libmysqlcl

**URL:** <https://www.ruby-forum.com/t/ruby-cant-open-library-library-mysql-lib-mysql-libmysqlcl/98481>\
**Category:** Rails\
**Created:** [January 29, 2006, 6:43pm UTC](https://www.ruby-forum.com/t/ruby-cant-open-library-library-mysql-lib-mysql-libmysqlcl/98481 "2006-01-29T18:43:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![arpan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e480ec/32.png) [@arpan](https://www.ruby-forum.com/u/arpan)\
**Post date:** [January 29, 2006, 6:43pm UTC](https://www.ruby-forum.com/t/ruby-cant-open-library-library-mysql-lib-mysql-libmysqlcl/98481/1 "2006-01-29T18:43:16Z")

</div>

When I try to start a Rails app, I get the following error:

ruby can’t open library:  
/Library/MySQL/lib/mysql/libmysqlclient.12.dylib

I’m on OS X and was previously using Complete MySQL. Recently, I  
upgraded to MySQL 4.1 using the regular MySQL installer.

I think that this problem probably occurred after that upgrade, as I  
have not used Rails after upgrading (about a couple weeks).

Any idea how to correct the problem?

Thanks.  
Arpan

---

<div class="post-metadata">

**Author:** ![arpan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e480ec/32.png) [@arpan](https://www.ruby-forum.com/u/arpan)\
**Post date:** [January 29, 2006, 8:53pm UTC](https://www.ruby-forum.com/t/ruby-cant-open-library-library-mysql-lib-mysql-libmysqlcl/98481/2 "2006-01-29T20:53:29Z")

</div>

This is just a wild guess from left field, but I had troubles on linux  
when I switched to  
MySQL 4.1 because stuff was still looking for the libmysqlclient.so.12  
and MySQL had a  
newer version. Had to reinstall everything that used that module.

So, in short, try reinstalling the ruby mysql connector.

b

---

<div class="post-metadata">

**Author:** ![arpan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e480ec/32.png) [@arpan](https://www.ruby-forum.com/u/arpan)\
**Post date:** [January 30, 2006, 3:29am UTC](https://www.ruby-forum.com/t/ruby-cant-open-library-library-mysql-lib-mysql-libmysqlcl/98481/3 "2006-01-30T03:29:34Z")

</div>

I tried that.

I ran this command.  
sudo gem install mysql – --with-mysql-dir=/usr/local/mysql

And it gave a success message. But I still get the same error. Anything  
else I should do?

---

<div class="post-metadata">

**Author:** ![arpan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e480ec/32.png) [@arpan](https://www.ruby-forum.com/u/arpan)\
**Post date:** [January 30, 2006, 8:42pm UTC](https://www.ruby-forum.com/t/ruby-cant-open-library-library-mysql-lib-mysql-libmysqlcl/98481/4 "2006-01-30T20:42:47Z")

</div>

> You should probably reply and post the error you get again… and mabye  
> your versions of  
> everything (ruby, gems, mysql, OS X).

This is what happens. I start the webbrick server from the console. It  
starts and opens the intro page. But when I try to access any controller  
that accesses the DB, it fails, and the server terminates with this  
message:

dyld: ruby can’t open library:  
/Library/MySQL/lib/mysql/libmysqlclient.12.dylib (No such file or  
directory, errno = 2)  
Trace/BPT trap

ruby: 1.8.2  
mysql: 4.1  
os X: 10.3.9

As noted, I have tried reinstalling the mysql ruby gem, but no change.  
Also, I searched for the above mentioned file, and it does not exist of  
the system, so I guess the new version does not have that file. After  
deleting the previous version of MySQL (Complete Mysql 4.0), I installed  
MySQL 4.1 using the installer from MySQL website.

I think that the problem might lie with some configuration error with  
Ruby, but have no idea of how to correct it.

If there is no way to correct it, I might have to reinstall Ruby and the  
gems. Would that be the correct option. If so, what would be the best  
way to remove, and then reinstall it?

Appreciate any help you can provide.  
Thank you.

Arpan

---

<div class="post-metadata">

**Author:** ![arpan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e480ec/32.png) [@arpan](https://www.ruby-forum.com/u/arpan)\
**Post date:** [January 30, 2006, 6:51am UTC](https://www.ruby-forum.com/t/ruby-cant-open-library-library-mysql-lib-mysql-libmysqlcl/98481/5 "2006-01-30T06:51:35Z")

</div>

Hey Arpan… sorry but I don’t do much on Macs. My only further  
suggestion would be to  
search the web for “ruby libmysqlclient.so.12” (or whatever it was) and  
search your hard  
drive for any all copies of libmysqlclient. Maybe it’s actually there  
but a path is  
screwed up. That and hopefully someone else will be able to answer… as  
we’ve seen ample  
evidence of lately, there are a lot of Mac users on this list!

You should probably reply and post the error you get again… and mabye  
your versions of  
everything (ruby, gems, mysql, OS X).

good luck,

b
