Library not loaded:libmysqlclient.18.dylib (LoadError)

rake db:create

Error log:

/Users/xi4oh4o/.rvm/gems/ruby-2.0.0-p353/gems/mysql2-0.3.14/lib/mysql2.rb:8:in `require': dlopen(/Users/xi4oh4o/.rvm/gems/ruby-    2.0.0-p353/gems/mysql2-0.3.14/lib/mysql2/mysql2.bundle, 9): Library not loaded: /Users/xi4oh4o/Downloads/mysql-5.6.15/libmysql/libmysqlclient.18.dylib (LoadError)
  Referenced from: /Users/xi4oh4o/.rvm/gems/ruby-2.0.0-p353/gems/mysql2-0.3.14/lib/mysql2/mysql2.bundle
  Reason: image not found - /Users/xi4oh4o/.rvm/gems/ruby-2.0.0-p353/gems/mysql2-0.3.14/lib/mysql2/mysql2.bundle
from /Users/xi4oh4o/.rvm/gems/ruby-2.0.0-p353/gems/mysql2-0.3.14/lib/mysql2.rb:8:in `<top (required)>'
from /Users/xi4oh4o/.rvm/gems/ruby-2.0.0-p353@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require'
from /Users/xi4oh4o/.rvm/gems/ruby-2.0.0-p353@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
from /Users/xi4oh4o/.rvm/gems/ruby-2.0.0-p353@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each'
from /Users/xi4oh4o/.rvm/gems/ruby-2.0.0-p353@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require'
from /Users/xi4oh4o/.rvm/gems/ruby-2.0.0-p353@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'
from /Users/xi4oh4o/.rvm/gems/ruby-2.0.0-p353@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
from /Users/xi4oh4o/.rvm/gems/ruby-2.0.0-p353@global/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
from /Users/xi4oh4o/Sites/rails_projects/example/config/application.rb:7:in `<top (required)>'
from /Users/xi4oh4o/.rvm/gems/ruby-2.0.0-p353/gems/railties-4.0.2/lib/rails/commands.rb:74:in `require'
from /Users/xi4oh4o/.rvm/gems/ruby-2.0.0-p353/gems/railties-4.0.2/lib/rails/commands.rb:74:in `block in <top (required)>'
from /Users/xi4oh4o/.rvm/gems/ruby-2.0.0-p353/gems/railties-4.0.2/lib/rails/commands.rb:71:in `tap'
from /Users/xi4oh4o/.rvm/gems/ruby-2.0.0-p353/gems/railties-4.0.2/lib/rails/commands.rb:71:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'

Run:

$ otool -L /Users/xi4oh4o/.rvm/gems/ruby-2.0.0-p353/gems/mysql2-0.3.14/lib/mysql2/mysql2.bundle

/Users/xi4oh4o/.rvm/gems/ruby-2.0.0-p353/gems/mysql2-0.3.14/lib/mysql2/mysql2.bundle:
/Users/xi4oh4o/.rvm/rubies/ruby-2.0.0-p353/lib/libruby.2.0.0.dylib (compatibility version 2.0.0, current version 2.0.0)
/Users/xi4oh4o/Downloads/mysql-5.6.15/libmysql/libmysqlclient.18.dylib (compatibility version 18.0.0, current version 18.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5)
/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)

abnormal:

/Users/xi4oh4o/Downloads/mysql-5.6.15/libmysql/libmysqlclient.18.dylib (compatibility version 18.0.0, current version 18.0.0)

Run:

$ install_name_tool -change /Users/xi4oh4o/Downloads/mysql-5.6.15/libmysql/libmysqlclient.18.dylib /Applications/MAMP/Library/lib/libmysqlclient.18.dylib /Users/xi4oh4o/.rvm/gems/ruby-2.0.0-p353/gems/mysql2-0.3.14/lib/mysql2/mysql2.bundle

    原文作者:xi4oh4o
    原文地址: https://segmentfault.com/a/1190000000359609
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞