Library Not Loaded issue for mysql client on Mac OS
On Mac OS Lion, with mysql installed from source, might get following error when trying to access mysql from rails:
Library not loaded: libmysqlclient.18.dylib (LoadError)
There are two solutons:
Put
export DLYD_LIBRARY_PATH=/usr/local/mysql/lib
into bash profile, somehow, it will raise warning time to time in Lion and ML: 'dyld: DYLD_ environment variables being ignored because main executable (/usr/bin/osascript) is code signed with entitlements', things like that.Run
sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/local/lib/libmysqlclient.18.dylib
, this works for me.
I bet there must be a better solution to do with the compile options when build from mysql source, untill them, second solution will work for me.
Written by Leon Guan
Related protips
4 Responses
![](https://coderwall-assets-0.s3.amazonaws.com/uploads/user/avatar/109082/0_jE7gvroZ48zTLGVP0IeavtHzs5P_bXVPxHUGvPJo5QbPZ8D1luxlR1SXND1yXiRxpWS_sqFhPSDY.jpeg)
Thank you! It really saved my lot of time.
I had recompiled about 5 times with different load options - this finally worked, but why it works I don't know, but thanks!
![](https://coderwall-assets-0.s3.amazonaws.com/uploads/user/avatar/8752/7cf0d98459ef6222f0e5b6123b4e944c.jpeg)
+1 thank you!
![](https://coderwall-assets-0.s3.amazonaws.com/uploads/user/avatar/139286/none.jpg)
did not work for me on OSX Yosemite(