LoginSignup
29
21

More than 3 years have passed since last update.

「 LoadError: dlopen(〜): Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib」と表示された場合の解決法

Posted at

railsで新しいアプリのDBを作成するべくrake db:createをしたところ、以下のエラーメッセージが表示。

LoadError: dlopen(/Users/(ユーザー名)/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/mysql2-0.5.2/lib/mysql2/mysql2.bundle, 9): Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
  Referenced from: /usr/local/opt/mysql@5.6/lib/libmysqlclient.18.dylib
  Reason: image not found - /Users/(ユーザー名)/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/mysql2-0.5.2/lib/mysql2/mysql2.bundle
/Users/(ユーザー名)/projects/(アプリ名)/config/application.rb:7:in `<top (required)>'
/Users/(ユーザー名)/projects/(アプリ名)/Rakefile:4:in `require_relative'
/Users/(ユーザー名)/projects/(アプリ名)/Rakefile:4:in `<top (required)>'
/Users/(ユーザー名)/.rbenv/versions/2.5.1/bin/bundle:23:in `load'
/Users/(ユーザー名)/.rbenv/versions/2.5.1/bin/bundle:23:in `<main>'
(See full trace by running task with --trace)

rake routesなどのコマンドでも同様のエラーが出るため、ニッチもサッチも行かず困った事態に。

bundle doctorを行いエラーが出たgemを再インストールしたり、 opensslを再インストールしてもダメ。

色々と探した結果、最終的にはこちらの記事の対処法で上手く行きました。
https://github.com/kelaberetiv/TagUI/issues/86

brew update && brew upgrade

でHomebrewとインストールしたパッケージ(Formula)のアップデートを実施。

改めてrake db:createをしたところDB作成に成功しました。他のコマンドもちゃんと実行できます。

直前にHomebrewで色々と入れたので、それが問題だったのかもしれません(node.jsが怪しい)。

同様のエラーが出た場合はご参考までにどうぞ。


参考にさせていただいた記事:brewのupdateとupgradeの違い
https://qiita.com/okhrn/items/aa71b066a525456550c0
(こちらの記事によればbrew upgradeだけで大丈夫かもしれません。)

29
21
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
29
21