Cronay
Cronay

Reputation: 4995

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

I installed vapor via homebrew and then immediately wanted to jump into a project by executing vapor new Hello but then got the following message back in the terminal:

dyld: Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
Referenced from: /usr/local/bin/vapor
Reason: image not found
zsh: abort      vapor new Hello

I tried some approaches to fix this like uninstalling and reinstalling openssl via brew but that didn't work . Also tried something I found in the internet but nothing worked. I assume it has something to do with vapor only working with version 1.0.0 but not 1.1.1 and that's what I have. I guess I need to downgrade to 1.0.0 but how'd I do that? I'm on MacOS Catalina if that matters.

Upvotes: 469

Views: 332233

Answers (30)

Munim
Munim

Reputation: 2768

If anyone is coming for [email protected] issue in MacOS Big Sur i.e. Library not loaded: /usr/local/opt/[email protected]/lib/libssl.1.1.dylib, here's what solved it for me-

brew install [email protected]
ln -s $(brew --prefix)/opt/openssl/lib/libssl.1.1.dylib /usr/local/lib/
ln -s $(brew --prefix)/opt/openssl/lib/libcrypto.1.1.dylib /usr/local/lib

Upvotes: 18

Matt Panzer
Matt Panzer

Reputation: 1216

I recommend checking this answer if you are seeing this error during import ssl in Python.

https://stackoverflow.com/a/78624360/1745635

(I understand this doesn't directly answer the OP, but may help many others that find this thread via Google like I did)

Upvotes: 1

James0r
James0r

Reputation: 148

For me it was that I had some old version of wget in my PATH. Removed it with:

/usr/local/bin/wget
λ  ~  rm -rf /usr/local/bin/wget

and then the brew installed executable had precedence and worked fine.

Upvotes: 1

Wolfgang Fahl
Wolfgang Fahl

Reputation: 15769

on a macOS 10.9.5 machine with macports 2.8.0:

sudo -s ln -s /opt/local/lib/openssl-1.0/libcrypto.1.0.0.dylib /opt/local/lib/libcrypto.1.0.0.dylib  

helped

Upvotes: 0

ShellZero
ShellZero

Reputation: 4651

The above answers didn't work for me. I am on Big Sur 11.6 with Xcode 12.5.1 and the brew keeps giving me an error saying my command line tools are outdated. First step is to update Xcode to 13.0. Restart the machine, and then run the

brew install [email protected]

Restart the terminal and now re-run the command which was giving the following error:

dyld: Library not loaded: /usr/local/opt/[email protected]/lib/libssl.1.1.dylib

Everything should work fine now, and you will not see the error message anymore.

Upvotes: 7

Taher
Taher

Reputation: 12040

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

brew install rbenv/tap/[email protected]
ln -sfn /usr/local/Cellar/[email protected]/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...

Upvotes: 1052

Chakreshwar Sharma
Chakreshwar Sharma

Reputation: 2610

I have openssl1.1 installed on my system, but the rails is somehow using the old reference i.e /usr/local/opt/openssl/lib/libssl.1.0.0.dylib (LoadError) but this doesn't exist on my Mojave 14.

I tried the below solutions but no luck:

  1. brew switch openssl 1.0.2t (Error: Unknown command: switch)
  2. reintalling openssl
  3. downgrade the version of openssl to 1.0
  4. Reintalling rvm and ruby

Finally, below solution works:

cp /usr/local/opt/openssl/lib/libssl.1.1.dylib /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
cp /usr/local/opt/openssl/lib/libcrypto.1.1.dylib /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib

Just copy the new openssl link to the old ones

OR

create the symlinks like below :

ln -sfn /usr/local/Cellar/[email protected]/1.0.2t /usr/local/opt/[email protected]

Upvotes: -1

AMDP
AMDP

Reputation: 365

there is/was no issue with the openssl version. In my case the symlink was missing, so:

sudo ln -s /opt/vagrant/embedded/lib/libssl.1.0.0.dylib /opt/local/lib/libssl.1.0.0.dylib
sudo ln -s /opt/vagrant/embedded/lib/libcrypto.1.0.0.dylib /opt/local/lib/libcrypto.1.0.0.dylib`

did the trick.

Upvotes: 1

Long Nguyen
Long Nguyen

Reputation: 10936

After trying all your answers, it still did not fix my issue on my Mac Big Sur. I tried on another Mac Big Sur and it worked for me. When try executing which openssl command to determine where is the OpenSSL symlink. It was /usr/bin/openssl, that different from on my PC is /usr/local/bin/openssl.

I realized that there are 2 OpenSSL symlinks on my PC. /usr/local/bin/openssl /usr/bin/openssl

I tried removing the current OpenSSL symlink

rm -rf /usr/local/bin/openssl

And run which openssl again, it pointed to /usr/bin/openssl

After that, openssl command worked for me.

Upvotes: 1

angabriel
angabriel

Reputation: 5028

December 2020 This thread has many answers, but none worked for me.
The top answer also suggests a downgrade:

brew switch ... throws Calling brew switch is disabled!

this worked for me:

brew install rbenv/tap/[email protected]
ln -sfn /usr/local/Cellar/[email protected]/1.0.2t /usr/local/opt/openssl

found here: https://github.com/kelaberetiv/TagUI/issues/86
(I need to run old mongodb 3.4 on OSX 10.13.x)

Upvotes: 245

Laure
Laure

Reputation: 86

I have tried several solutions proposed above without success.

So, I have installed the last ruby version 2.7.2 with rbenv, and upgraded my app.

Then I had a PG::ConnectionBad error.

I ran

brew postgresql-upgrade-database.

And now It’s working fine.

here more details about what I tried.

Upvotes: 2

Aviv
Aviv

Reputation: 14467

Explanation an solution: It seems that you're required to install older openssl version that is no longer exist on current brew repository ( 1.0.2t version ) . In order to solve it you should create a tap and extract an older version ( looking through repository history), after new installation create a link to this version and you're linked to the right version.

brew uninstall --ignore-dependencies openssl
brew tap-new $USER/old-openssl
brew extract --version=1.0.2t openssl $USER/old-openssl
brew install [email protected]
ln -s /usr/local/Cellar/[email protected]/1.0.2t /usr/local/opt/openssl

Documentation :

Taps (Third-Party Repositories) brew tap adds more repositories to the list of formulae that brew tracks, updates, and installs from. By default, tap assumes that the repositories come from GitHub, but the command isn’t limited to any one location.

 tap-new [options] user/repo
      Generate the template files for a new tap.
      
 --no-git: Don’t initialize a git repository for the tap.
 --pull-label: Label name for pull requests ready to be pulled (default pr-pull).
 --branch: Initialize git repository with the specified branch name (default main).

extract [options] formula tap Look through repository history to find the most recent version of formula and create a copy in tap/Formula/[email protected]. If the tap is not installed yet, attempt to install/clone the tap before continuing. To extract a formula from a tap that is not homebrew/core use its fully-qualified form of user/repo/formula.

extract [options] package user/repo
--version: Extract the specified version of formula instead of the most recent.
-f, --force: Overwrite the destination formula if it already exists.

Upvotes: 3

abbood
abbood

Reputation: 23548

This is the only thing that worked for me (OSX Catalina 10.15.7)

1- Download the file:

wget https://github.com/tebelorg/Tump/releases/download/v1.0.0/openssl.rb

2 - Run brew with the file downloaded:

brew install openssl.rb

Upvotes: 23

Auine
Auine

Reputation: 200

Had this error with [email protected]

Try to reinstall mysql

brew reinstall [email protected]

This will fix

Upvotes: -2

tkacperek
tkacperek

Reputation: 137

This worked for me:

brew uninstall openssl
brew tap-new $USER/old-openssl
brew extract --version=1.0.2t openssl $USER/old-openssl
brew install [email protected]

Source: https://github.com/kelaberetiv/TagUI/issues/635#issuecomment-560138773

Upvotes: 8

I found this question after searching for the first line of this error:

dyld: Library not loaded: /opt/local/lib/libcrypto.1.0.0.dylib
  Referenced from: /opt/local/lib/libgssapi_krb5.2.2.dylib
  Reason: image not found
Abort trap: 6

That I saw not from using vapor, but instead, as the result of using ssh and scp and git after upgrading some packages.

I think it's unwise to downgrade most packages as @Smokie and others suggested doing with openssl (especially for security-related packages).

So I generalized the answer posted by @MichalCichon on solving the problem with install_name_tool and that seems to have taken care of my issue (at least for now with ssh and scp; I think I'll be able to use a variant of this solution if the problem comes up again with another executable).

Because it was the non-existent /opt/local/lib/libcrypto.1.0.0.dylib library that was missing, and because I had a /opt/local/lib/libcrypto.1.1.dylib after upgrading, and because ssh and scp were referencing /opt/local/lib/libgssapi_krb5.2.2.dylib in an attempt to find /opt/local/lib/libcrypto.1.0.0.dylib, I just used install_name_tool like this:

$ sudo install_name_tool -change /opt/local/lib/libcrypto.1.0.0.dylib\
/opt/local/lib/libcrypto.1.1.dylib\
/opt/local/lib/libgssapi_krb5.2.2.dylib

Then tried running ssh again. It failed again, but this time with a different error:

dyld: Library not loaded: /opt/local/lib/libcrypto.1.0.0.dylib
  Referenced from: /opt/local/lib/libkrb5.3.3.dylib
  Reason: image not found
Abort trap: 6

So then I did:

$ sudo install_name_tool -change /opt/local/lib/libcrypto.1.0.0.dylib\
/opt/local/lib/libcrypto.1.1.dylib\
/opt/local/lib/libkrb5.3.3.dylib

and tried ssh again. Again it failed, but with yet another different error:

dyld: Library not loaded: /opt/local/lib/libcrypto.1.0.0.dylib
  Referenced from: /opt/local/lib/libk5crypto.3.1.dylib
  Reason: image not found
Abort trap: 6

So then I did:

$ sudo install_name_tool -change /opt/local/lib/libcrypto.1.0.0.dylib\
/opt/local/lib/libcrypto.1.1.dylib\
/opt/local/lib/libk5crypto.3.1.dylib

and tried ssh again. Again it failed, but with yet another different error:

dyld: Library not loaded: /opt/local/lib/libcrypto.1.0.0.dylib
  Referenced from: /opt/local/lib/libkrb5support.1.1.dylib
  Reason: image not found
Abort trap: 6

So then I did:

$ sudo install_name_tool -change /opt/local/lib/libcrypto.1.0.0.dylib\
/opt/local/lib/libcrypto.1.1.dylib\
/opt/local/lib/libkrb5support.1.1.dylib

and tried ssh again. Finally, ssh and scp and git resumed working as expected.

Thank you @MichalCichon for a great answer that I was able to generalize beyond vapor to allow myself to continue using ssh without downgrading my openssl!

Upvotes: 1

Jerry
Jerry

Reputation: 21

My recommendation is to never lower your openssl lib version for the sake of getting your build to work. Better to download the source code of the required lib and build it against the openssl version you have on your localhost.

I came across this posting while going through the same issue but was not comfortable lowering the openssl version come what may. Finally took the source code and build the app and it worked. I dont know why devs have their old versions of openssl on their boxes and which they build the dist packages and publish against those old version.

Upvotes: 2

Luis Rodriguez
Luis Rodriguez

Reputation: 483

I had to downgrade OpenSSL in this way:

brew uninstall --ignore-dependencies openssl
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/30fd2b68feb458656c2da2b91e577960b11c42f4/Formula/openssl.rb

It was the only solution that worked for me.

Upvotes: 11

ipatch
ipatch

Reputation: 4032

i'll throw in my 2 cents because i didn't see an answer that resolved my issue.

my particular use case, relates to starting a legacy rails application using ruby 2.6.3 with postgres 10.x series.

  • i'm running macOS 10.13.x high sierra
  • i update brew almost on a daily basis, and the version of openssl i have is 1.1

haven't started the rails app in several months, needed to perform some maintenance on the app today and, got some lovely ❤ error messages below,

9): Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib (LoadError)
  Referenced from: /usr/local/opt/postgresql/lib/libpq.5.dylib

echo "and"

9): Library not loaded: /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib (LoadError)
  Referenced from: /usr/local/opt/postgresql/lib/libpq.5.dylib
  Reason: image not found -

the quickest way to work around my particular issue was to create a smylink from the current,

libssl.1.1.dylib
libcrypto.1.1.dylib

create 2 symlinks

cd /usr/local/opt/openssl/lib/
ln -sf libcrypto.1.1.dylib libcrypto.1.0.0.dylib
ln -sf libssl.1.1.dylib libssl.1.0.0.dylib

paths and version numbers are obviously going to change over time so pay attention to the path and version numbers while creating the above symlinks. after the symlinks were created, i am able to start my rails app.

cheers

leaving this here for future me 👴🏼

Upvotes: 17

Vikramaditya
Vikramaditya

Reputation: 5574

Above solution didn't work for me.

First run brew doctor. if you see something like

Error: unknown or unsupported macOS version: :mountain_lion

then there are some outdated packages which needs to be removed, mine was
mongodb.

It could be python@2, node@6 or some other package.

uninstall those packages brew uninstall [name] then run brew doctor to verify if everything is ok. Then you can reinstall those packages again after brew update && brew upgrade.

Upvotes: 3

Chitransh Gaurav
Chitransh Gaurav

Reputation: 516

brew reinstall openssl

It automatically updates mysql server compatible with openssl. I tried many things, but only this worked for me.

Upvotes: 14

Leadoux
Leadoux

Reputation: 71

Had this issue when trying to use LastPass CLI via Alfred on my Catalina install.

brew update && brew upgrade fixed the issue.

This is a much better optin than downgrading openssl.

Upvotes: 7

Afolabi Olaoluwa
Afolabi Olaoluwa

Reputation: 1948

Mehn this is me in July 7, 2020, after facing this error for 4 hours. This is the only command that worked for me:

brew update && brew upgrade

Upvotes: 8

Pauls Bebris
Pauls Bebris

Reputation: 458

This worked for me: brew uninstall openssl; brew uninstall openssl; brew install https://github.com/tebelorg/Tump/releases/download/v1.0.0/openssl.rb

Suggested in this post: https://github.com/kelaberetiv/TagUI/issues/635#issuecomment-560139279

Upvotes: 2

dvdmmc
dvdmmc

Reputation: 430

I was able to solve this by upgrading Python 3 via brew

brew upgrade python@3

Upvotes: 2

Randall Blake
Randall Blake

Reputation: 684

I ran into a similar error trying to run rails with postgresql. (I found this SO looking for a solution. Homebrew broke alot of things when it switched to open SSL 1.1.1) The above answers did not work for me (Mac 10.14.6). However, the answer found here did:

brew install --upgrade openssl
brew reinstall postgresql

Upvotes: 2

stevec
stevec

Reputation: 52198

I spent a lot of time trying all of the above, and nothing seemed to solve. Then I resorted the reinstalling ruby, and 2 minutes later the problem entirely vanished.

I hope this saves something else some time.

Upvotes: 1

B.K
B.K

Reputation: 897

I had a similar issue and running the command below fixed the error for me:

brew update && brew upgrade

Upvotes: 12

NinjaDev
NinjaDev

Reputation: 1258

If you are using ruby-2.7.0 on MacOS Catalina 10.15

$ brew reinstall [email protected]

or

$ rvm reinstall 2.7.0
$ brew tap --repair
$ brew doctor

Upvotes: 7

J.Z
J.Z

Reputation: 935

first, list the details of the installed openssl version(or other programs) by:

$ls -al /usr/local/Cellar/openssl*
/usr/local/Cellar/openssl:
total 0
drwxr-xr-x    3 mba  staff    96 Nov 30 17:18 .
drwxrwxr-x  170 mba  admin  5440 Apr  8 02:03 ..
drwxr-xr-x   13 mba  staff   416 Nov 21 03:13 1.0.2t

/usr/local/Cellar/[email protected]:
total 0
drwxr-xr-x    4 mba  staff   128 Apr  7 18:35 .
drwxrwxr-x  170 mba  admin  5440 Apr  8 02:03 ..
drwxr-xr-x   14 mba  staff   448 Oct  1  2019 1.1.1d
drwxr-xr-x   14 mba  staff   448 Apr  7 18:35 1.1.1f

as above output, there are only one "right" versions "openssl" in my mac. then, switch to it:

$brew switch openssl 1.0.2t                                 
Cleaning /usr/local/Cellar/openssl/1.0.2t
Opt link created for /usr/local/Cellar/openssl/1.0.2t

Upvotes: 75

Related Questions