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
Ruby Convert String to Method Name
How to Get an Empty Temporary Directory in Ruby on Rails
Error Running 'Requirements_Osx_Brew_Libs_Install...' on MAC 10.7
Is Time.Zone.Now.To_Date Equivalent to Date.Today
Differencebetween "Rails S" and "Bundle Exec Rails S"
Understanding Method_Added for Class Methods
Rails 4 User Roles and Permissions
How to Expire a View Cached Fragment from Console
Passenger Installation with Nginx Fails
Rails 3 Joins -- Select Only Certain Columns
Rendering File with Mime Type in Rails
Model Using Modules in Rails Application
Is Time.Zone.Now.To_Date Equivalent to Date.Today
How to Install 'Cocoapods' Gem from Rubygems.Org (Bad Response Backend Read Error)
Ruby on Rails: Yielding Specific Views in a Specific Places in the Layout