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

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

ruby can’t open library:

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?


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
and MySQL had a
newer version. Had to reinstall everything that used that module.

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


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?

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

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.


Hey Arpan… sorry but I don’t do much on Macs. My only further
suggestion would be to
search the web for “ruby” (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,


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs