2015-11-19 12 views
8

理由:イメージが見つかりません - /Users/mdurrant/.rvm/gems/ruby-2.1.5/extensions/x86_64-darwin-私が作成しようとすると、しかしrails-mysql rake db:ライブラリがロードされていないlibmysqlclient.20.dylibイメージが見つかりません

$ mysql -uroot 
Welcome to the MySQL monitor. Commands end with ; or \g. 
Your MySQL connection id is 1 
Server version: 5.6.27 MySQL Community Server (GPL) 
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. 
Oracle is a registered trademark of Oracle Corporation and/or its 
affiliates. Other names may be trademarks of their respective 
owners. 
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. 
mysql> 

から14/2.1.0-静的/ mysql2-0.3.20/mysql2/mysql2.bundle

私たちのアプリケーションは、[OK]を動作しているようだMySQLのバージョン5.6が必要ですレールからデータベースを取得する:

$ rake db:create 
rake aborted! 
LoadError: dlopen(/Users/mdurrant/.rvm/gems/ruby-2.1.5/extensions/x86_64-darwin-14/2.1.0-static/mysql2-0.3.20/mysql2/mysql2.bundle, 9): Library not loaded: /usr/local/opt/mysql/lib/libmysqlclient.20.dylib 
    Referenced from: /Users/mdurrant/.rvm/gems/ruby-2.1.5/extensions/x86_64-darwin-14/2.1.0-static/mysql2-0.3.20/mysql2/mysql2.bundle 
    Reason: image not found - /Users/mdurrant/.rvm/gems/ruby-2.1.5/extensions/x86_64-darwin-14/2.1.0-static/mysql2-0.3.20/mysql2/mysql2.bundle 
/Users/mdurrant/.rvm/gems/ruby-2.1.5/gems/activesupport-3.2.22/lib/active_support/dependencies.rb:251:in `require' 
/Users/mdurrant/.rvm/gems/ruby-2.1.5/gems/activesupport-3.2.22/lib/active_support/dependencies.rb:251:in `block in require' 
/Users/mdurrant/.rvm/gems/ruby-2.1.5/gems/activesupport-3.2.22/lib/active_support/dependencies.rb:236:in `load_dependency' 
/Users/mdurrant/.rvm/gems/ruby-2.1.5/gems/activesupport-3.2.22/lib/active_support/dependencies.rb:251:in `require' 
/Users/mdurrant/.rvm/gems/ruby-2.1.5/gems/mysql2-0.3.20/lib/mysql2.rb:31:in `<top (required)>' 
/Users/mdurrant/.rvm/gems/ruby-2.1.5/gems/bundler-1.10.6/lib/bundler/runtime.rb:76:in `require' 
/Users/mdurrant/.rvm/gems/ruby-2.1.5/gems/bundler-1.10.6/lib/bundler/runtime.rb:76:in `block (2 levels) in require' 
/Users/mdurrant/.rvm/gems/ruby-2.1.5/gems/bundler-1.10.6/lib/bundler/runtime.rb:72:in `each' 
/Users/mdurrant/.rvm/gems/ruby-2.1.5/gems/bundler-1.10.6/lib/bundler/runtime.rb:72:in `block in require' 
/Users/mdurrant/.rvm/gems/ruby-2.1.5/gems/bundler-1.10.6/lib/bundler/runtime.rb:61:in `each' 
/Users/mdurrant/.rvm/gems/ruby-2.1.5/gems/bundler-1.10.6/lib/bundler/runtime.rb:61:in `require' 
/Users/mdurrant/.rvm/gems/ruby-2.1.5/gems/bundler-1.10.6/lib/bundler.rb:134:in `require' 
/Users/mdurrant/eq/lynx/config/application.rb:10:in `<top (required)>' 
/Users/mdurrant/eq/lynx/Rakefile:10:in `require' 
/Users/mdurrant/eq/lynx/Rakefile:10:in `<top (required)>' 
/Users/mdurrant/.rvm/gems/ruby-2.1.5/bin/ruby_executable_hooks:15:in `eval' 
/Users/mdurrant/.rvm/gems/ruby-2.1.5/bin/ruby_executable_hooks:15:in `<main>' 
(See full trace by running task with --trace) 
14:18:13 mdurrant EQ-267 /Users/mdurrant/eq/lynx master 
$ 

答えて

22

修正は

gem uninstall mysql2 
は次に

bundle # gem install mysql2 would also work 

これは再コンパイルされ、インストールのMySQL 5.7.9を有するから残された参照を解決して再度取り付けます。

+0

$ソースは完全にそれを解決します – Ben

+0

私のためにも解決されました。それは正解です。あなたが喜んでいるなら、それを正しいものとしてマークしてください。 – lucasarruda

+0

それは私のために働いた – kalpa

0

OS Xはlibmysqlclient.18.dylibライブラリを見つけることができません。それはアクセス可能、私たちは、次の操作を行うことができますようにするには:

export DYLD_LIBRARY_PATH=/usr/local/mysql/lib:$DYLD_LIBRARY_PATH 

あなたの〜/ .bash_profileのに、後にそれを調達することを忘れないでください:〜/ .bash_profileの

sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/local/lib/libmysqlclient.18.dylib 
+0

あなたの答えに詳細を追加し、より読みやすくするために書式を設定します。 – Takarii

関連する問題