{"id":702,"date":"2013-07-19T09:42:04","date_gmt":"2013-07-19T09:42:04","guid":{"rendered":"http:\/\/invisiblezero.net\/?p=702"},"modified":"2013-07-19T09:42:04","modified_gmt":"2013-07-19T09:42:04","slug":"ruby-on-rails-library-not-loaded-libmysqlclient-18-dylib-loaderror","status":"publish","type":"post","link":"http:\/\/ndthanh.com\/ruby-on-rails-library-not-loaded-libmysqlclient-18-dylib-loaderror\/","title":{"rendered":"Ruby on Rails – Library not loaded: libmysqlclient.18.dylib (LoadError)"},"content":{"rendered":"
<\/p>\n
This is a typical mysql error on Mac when you try to start Rails server, libmysqlclient.18.dylib can be something else like that libmysqlclient.16.dylib, .. etc<\/p>\n
The root reason is<\/strong><\/span> : libmysqlclient.18.dylib is not under \/usr\/lib – this is place where Ruby (or Rails ?) will look for this dynamic library<\/p>\n <\/p>\n Solution<\/strong><\/span> : well, we just need to create a symbolic link of libmysqlclient.18.dylib under \/usr\/lib . you can find for libmysqlclient.* (this mean libmysqlclient and whatever characters behind it) in your mysql installation folder. to look for it, execute this command<\/p>\n then<\/p>\n Finally, we create the symbolic link, this is the command that I used to make it work for me. This way you don’t need to use install_name_tool every time you update your mysql<\/p>\n This is a typical mysql error on Mac when you try to start Rails server, libmysqlclient.18.dylib can be something else like that libmysqlclient.16.dylib, .. etc The root reason is : libmysqlclient.18.dylib is not under \/usr\/lib – this is place where Ruby (or Rails ?) will look for this dynamic library Solution : well, we just…<\/p>\n\nwhich mysql\n#we have \/usr\/local\/mysql\/bin\/mysql - it means installation folder is \/usr\/local\/mysql\n<\/pre>\n
\ncd \/usr\/local\/mysql\nsudo find . -name 'libmysqlclient.*'\n# in this case, i have .\/lib\/libmysqlclient.18.dylib returned, it my mysql lib path is \/usr\/local\/mysql\/lib\/libmysqlclient.18.dylib\n<\/pre>\n
\nsudo ln -s \/usr\/local\/mysql\/lib\/libmysqlclient.18.dylib \/usr\/lib\/libmysqlclient.18.dylib\n<\/pre>\n","protected":false},"excerpt":{"rendered":"