Rake Db:Migrate Error with MySQL2 Gem - Library Not Loaded: Libssl.1.0.0.Dylib

rake db:migrate error with mysql2 gem - Library not loaded: libssl.1.0.0.dylib

So the answer to my own question was the following - out of the 5 or so other solutions on stackoverflow, this is the only one that worked:

brew install openssl

cd /usr/local/Cellar/openssl/1.0.1f/lib

sudo cp libssl.1.0.0.dylib libcrypto.1.0.0.dylib /usr/lib/

Full solution here - https://mithun.co/hacks/library-not-loaded-libcrypto-1-0-0-dylib-issue-in-mac/

mysql2: Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib after homebrew update

OpenSSL 1.0 reached EOL on 2019-12-31

Reinstalling mysql2 gem with --with-cflags and --with-ldflags arguments pointing to openssl@1.1 fixed the error:

gem uninstall mysql2
gem install mysql2 -v 0.4.4 -- --with-cflags=\"-I/usr/local/opt/openssl@1.1/include\" --with-ldflags=\"-L/usr/local/opt/openssl@1.1/lib\"

bundle install

dyld: Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib

Update: As of December 2020 and beyond, brew switch does not work, so use the other answer by @angabriel:

brew install rbenv/tap/openssl@1.0
ln -sfn /usr/local/Cellar/openssl@1.0/1.0.2t /usr/local/opt/openssl

Original Answer:
Switch to an older openssl package

brew switch openssl 1.0.2s

Or, depending on your exact system configuration, you may need to switch to a different version. Check the output of ls -al /usr/local/Cellar/openssl for the version number to switch to.

brew switch openssl 1.0.2q
# or
brew switch openssl 1.0.2r
# or
brew switch openssl 1.0.2s
# or
brew switch openssl 1.0.2t
# etc...

Library not loaded: /opt/local/lib/libssl.1.0.0.dylib (LoadError)

Your questions mentions three paths /opt/local, /usr/local and /etc/openssl they belong to Macports, Homebrew and SM Framework respectively.

As the last one is used to build static rubies it is harmeless and not related to the problem. The other two suggest that you have switched from macports to homebrew between installing the rubies.

You need to reinstall ruby-2.0.0-p195 which is referring still the old paths from macports, you can do it with:

rvm reinstall ruby-2.0.0-p195

You can get more details about the rubies and openssl paths they use running:

rvm --debug osx-ssl-certs update all


Related Topics



Leave a reply



Submit