Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix error caused by libmysqlclient.15.dylib not being loaded?

I've upgraded to Rails 2.2.2 and installed the MySQL 2.7 gem and am seeing this error when I try to run a migration or start the server:

dlopen(/Library/Ruby/Gems/1.8/gems/mysql-2.7/lib/mysql.bundle, 9): Library not loaded: /usr/local/mysql/lib/mysql/libmysqlclient.15.dylib
Referenced from: /Library/Ruby/Gems/1.8/gems/mysql-2.7/lib/mysql.bundle
Reason: image not found - /Library/Ruby/Gems/1.8/gems/mysql-2.7/lib/mysql.bundle

What's the fix?

like image 558
Gabe Hollombe Avatar asked Feb 05 '09 21:02

Gabe Hollombe


4 Answers

I had to remove the directory from the old references:

sudo install_name_tool -change libmysqlclient.18.dylib
    /usr/local/mysql/lib/libmysqlclient.18.dylib
    /Library/Ruby/Gems/1.8/gems/mysql-2.7/lib/mysql.bundle

sudo install_name_tool -change libmysqlclient.18.dylib 
    /usr/local/mysql/lib/libmysqlclient.18.dylib
    /Library/Ruby/Gems/1.8/gems/mysql-2.7/mysql.bundle
like image 145
Sytse Avatar answered Sep 28 '22 05:09

Sytse


Answering my own question for the benefit of others.

I found the fix here.

Run:

sudo install_name_tool -change /usr/local/mysql/lib/mysql/libmysqlclient.15.dylib /usr/local/mysql/lib/libmysqlclient.15.dylib /Library/Ruby/Gems/1.8/gems/mysql-2.7/lib/mysql.bundle
sudo install_name_tool -change /usr/local/mysql/lib/mysql/libmysqlclient.15.dylib /usr/local/mysql/lib/libmysqlclient.15.dylib /Library/Ruby/Gems/1.8/gems/mysql-2.7/mysql.bundle

Worked for me.

like image 20
Gabe Hollombe Avatar answered Sep 28 '22 07:09

Gabe Hollombe


If Gabe Hollombe solution doesn't works then try this

sudo install_name_tool -change libmysqlclient.15.dylib /usr/local/mysql/lib/libmysqlclient.15.dylib /Library/Ruby/Gems/1.8/gems/mysql-2.7/lib/mysql.bundle

sudo install_name_tool -change libmysqlclient.15.dylib /usr/local/mysql/lib/libmysqlclient.15.dylib /Library/Ruby/Gems/1.8/gems/mysql-2.7/mysql.bundle
like image 34
Anand Sterlite Avatar answered Sep 28 '22 07:09

Anand Sterlite


Using sudo can often lead to unexpected issues. What worked for me was uninstalling the mysql2 gem and reinstalling it.

gem uninstall mysql2 bundle

like image 28
mujtaba Avatar answered Sep 28 '22 06:09

mujtaba