Sign up Sign in Samples Blog contact support
Following install instructions leads to LoadError: Library not loaded: libmysqlclient.18.dylib

Support Ticket

answered
 
+issue

A dynamic library needed for MySql fails to load.  The context is Mac OS 10.9.2, bash, RVM, ruby 1.9.3.  DYLD_LIBRARY_PATH is not set in this context and the dynamic library is not found. 

+example

While following the wagn installation instructions I entered rake wagn:create and got the following error:

 

LoadError: dlopen(/Users/phoenix/.rvm/gems/ruby-1.9.3-p448@wagn_wheels/gems/mysql2-0.3.15/lib/mysql2/mysql2.bundle, 9): Library not loaded: libmysqlclient.18.dylib

  Referenced from: /Users/phoenix/.rvm/gems/ruby-1.9.3-p448@wagn_wheels/gems/mysql2-0.3.15/lib/mysql2/mysql2.bundle

  Reason: image not found - /Users/phoenix/.rvm/gems/ruby-1.9.3-p448@wagn_wheels/gems/mysql2-0.3.15/lib/mysql2/mysql2.bundle

 
+discussion
I found a solution to the problem on StackOverflow.  It's not a wagn-specific problem & was tagged there as a Rails issue.  I never encountered this problem using Rails but ran into it with wagn because with Rails I'd only ever used sqlite; the problem is exposed when needing to load dynamix libraries.  I'm sure I won't be the last to run into this when trying wagn for the first time so I'm posting it here to save others' time.  

Credit for the original solution can be found in place at StackOverflow: http://stackoverflow.com/questions/9201406/ruby-on-rails-mac-x-os-lion-run-server-loaderror

The solution is simple:
export
DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:/usr/local/mysql/lib"

Excellent. Thanks so much for posting the solution!

--Ethan McCutchen.....2014-04-11 15:33:54 +0000