{"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":"

\"rails\"<\/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

\nwhich mysql\n#we have \/usr\/local\/mysql\/bin\/mysql - it means installation folder is \/usr\/local\/mysql\n<\/pre>\n

then<\/p>\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

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

\nsudo ln -s \/usr\/local\/mysql\/lib\/libmysqlclient.18.dylib \/usr\/lib\/libmysqlclient.18.dylib\n<\/pre>\n","protected":false},"excerpt":{"rendered":"

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

Read More<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[53,94,95,66],"tags":[],"aioseo_notices":[],"views":7,"_links":{"self":[{"href":"http:\/\/ndthanh.com\/wp-json\/wp\/v2\/posts\/702"}],"collection":[{"href":"http:\/\/ndthanh.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/ndthanh.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/ndthanh.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/ndthanh.com\/wp-json\/wp\/v2\/comments?post=702"}],"version-history":[{"count":0,"href":"http:\/\/ndthanh.com\/wp-json\/wp\/v2\/posts\/702\/revisions"}],"wp:attachment":[{"href":"http:\/\/ndthanh.com\/wp-json\/wp\/v2\/media?parent=702"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/ndthanh.com\/wp-json\/wp\/v2\/categories?post=702"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/ndthanh.com\/wp-json\/wp\/v2\/tags?post=702"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}