461

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.

5

42 Answers 42

1045

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...
32
  • 35
    This is the best solution and simplest. Yet Homebrew will remove packages that are deprecated. Not sure when will this solution stop working
    – tom10271
    Dec 19, 2019 at 2:33
  • 14
    This work for me with a little change the last letter "r" brew switch openssl 1.0.2r on MacOS Catalina Jan 9, 2020 at 14:42
  • 26
    What should I do if I don't have any "older" versions installed on my Mac, but just 1.1.1g?
    – yegor256
    Sep 13, 2020 at 5:59
  • 24
    When running ls -al /usr/local/Cellar/openssl did anyone get ls: /usr/local/Cellar/openssl: No such file or directory?
    – Babbz77
    Sep 25, 2020 at 21:18
  • 30
    "brew switch" is already disabled. So what then?
    – deyvw
    Jan 13, 2021 at 17:38
243

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/openssl@1.0
ln -sfn /usr/local/Cellar/openssl@1.0/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)

13
  • 11
    Wow people should look for this, this on the only that helped me!!
    – Moshe D
    Jan 4, 2021 at 9:16
  • 18
    brew install rbenv/tap/openssl@1.0 took forever! But finally a solution that worked for me using macOS Big Sur, thanks @angabriel!
    – chris
    Jan 8, 2021 at 8:26
  • 6
    This solution that worked for me using macOS Big Sur, thanks
    – chifu lin
    Jan 14, 2021 at 9:30
  • 4
    Worked on macOS Mojave fyi, thank you for the workaround!
    – chompy
    Jan 17, 2021 at 1:13
  • 3
    This worked for me on High Sierra with /usr/local/Cellar/mysql/5.7.20/bin/mysqld
    – Frak
    Feb 8, 2021 at 20:32
100

brew switch openssl 1.0.2s

worked for me on "macOS Mojave", "version 10.14.6".

3
  • Thanks my Tableau 2019.10.3 was not opening in Mac OS Mojave and this command helped solve that! Feb 3, 2020 at 10:00
  • 2
    brew switch openssl 1.0.2p
    – Evhz
    Feb 17, 2020 at 23:57
  • brew uninstall --ignore-dependencies openssl brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/30fd2b68feb458656c2da2b91e577960b11c42f4/Formula/openssl.rb
    – Johhn
    Sep 2, 2020 at 13:59
82

Try to use install_name_tool:

sudo install_name_tool -change /usr/local/opt/openssl/lib/libssl.1.0.0.dylib /usr/local/opt/openssl/lib/libssl.1.1.dylib $(which vapor)
sudo install_name_tool -change /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/opt/openssl/lib/libcrypto.1.1.dylib $(which vapor)

In my case it start working when I used install_name_tool. The order of the parameter is following: old value (incorrect), then new value (where you have your openssl) and the path to vapor (which can be easily get by $(which vapor).

11
  • 22
    brew update && brew upgrade will upgrade all packages, it causes HUGE problem
    – tom10271
    Dec 19, 2019 at 2:30
  • 2
    yeah please remove brew upgrade from the answer @michal-cichon
    – macool
    Dec 26, 2019 at 14:22
  • 2
    @Zheden Vapor is a web framework implemented in Swift. Please take a look at the original question in this thread. If you don't know what Vapor is then this thread probably doesn't answer your question. If you use Homebrew to manage your dependencies, try Smokie's answer. Feb 6, 2020 at 17:09
  • 1
    Thanks @musafar006. I didn't notice I copied a wrong path in the second command. Feb 12, 2020 at 8:29
  • 1
    Why @Cronay is this still the correct answer? can u changed to the most voted ? Apr 16, 2020 at 21:57
76

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/openssl@1.1:
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
4
  • I spent a whole day installing, reinstalling rails versions, mysql2 gems with various flags and options. This worked like a charm! Thanks mate! Apr 23, 2020 at 8:46
  • 4
    Thanks so much for this. What shows that 1.0.2t is the "right" version? I have a 1.0.2r and a 1.1.1d and 1.1.1f.
    – David Mann
    Jul 6, 2020 at 17:41
  • 7
    there are only one "right" versions - what does this mean? How do you tell? Jul 17, 2020 at 11:03
  • i can see only /usr/local/Cellar/openssl@1.1: /usr/local/Cellar/openssl@3: my macos version is 13.5.1
    – Avyaan
    Sep 15 at 13:13
59

For MacOS 10.15 Catalina try to install the previous openssl:

brew update && brew upgrade
brew uninstall --ignore-dependencies openssl
brew install https://github.com/tebelorg/Tump/releases/download/v1.0.0/openssl.rb
2
  • 4
    Error: Calling Non-checksummed download of openssl formula file from an arbitrary URL is disabled! Use 'brew extract' or 'brew create' and 'brew tap-new' to create a formula file in a tap on GitHub instead. If reporting this issue please do so at (not Homebrew/brew or Homebrew/core): github.com/tebelorg/Tump/issues/new
    – abbood
    Oct 11, 2020 at 14:09
  • 2
    To install that GitHub link, we need to downgrade brew. cd /usr/local/Homebrew/ change to version 2.3.0 git checkout 2.3.0 then install HOMEBREW_NO_AUTO_UPDATE=1 brew install https://github.com/tebelorg/Tump/releases/download/v1.0.0/openssl.rb github.com/kelaberetiv/TagUI/issues/635#issuecomment-699482920 Nov 4, 2020 at 0:50
53
brew switch openssl 1.0.2q

MacOs Catalina Version 10.15 worked for me

3
  • I had to upgrade and update brew before this worked
    – ricks
    Mar 6, 2020 at 15:10
  • Error: openssl not found in the Cellar
    – AlxVallejo
    Oct 8, 2020 at 21:57
  • brew search openssl ==> Formulae curl-openssl ✔ glib-openssl openssl@1.1 homebrew/portable-ruby/portable-openssl only 1.1 is available now
    – abbood
    Oct 11, 2020 at 14:13
30

I had the same problem. I solved it by running these 2 commands:

brew uninstall vapor
brew install vapor/tap/vapor

It worked.

1
  • 1
    I just upgraded the client tool, not vapor but wget in my case. Which then used a later version of openssl brew upgrade vapor
    – flurdy
    Jan 24, 2020 at 10:42
27
brew switch openssl 1.0.2r

it work for me,macOS Mojave, Version 10.14.6

2
  • It works for me (macOS Catalina, ruby 2.4.1, rails 5.2.2, openssl 1.1.1f). Switched to 1.0.2s.
    – AntonAL
    Apr 19, 2020 at 15:31
  • similar works for me on macos high sierra 10.13.6 python3.6 Jul 7, 2020 at 14:07
26
brew switch openssl 1.0.2t

catalina this is ok.

1
  • For me on Catalina this is working: brew switch openssl 1.0.2j Sep 8, 2020 at 12:43
23

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
4
  • 1
    or brew tap cartr/qt4 && brew install cartr/qt4/openssl@1.0
    – jaynetics
    Nov 25, 2020 at 12:27
  • this worked for me, nov 2020 using "get github.com/tebelorg/Tump/releases/download/v1.0.0/openssl.rb"
    – Ignacio
    Nov 25, 2020 at 21:25
  • Worked. Just manually downloaded the file. Dec 1, 2020 at 12:10
  • just a fyi I tried the wget but got the following dyld: Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib Referenced from: /usr/local/bin/wget Reason: image not found Abort trap: 6 Dec 21, 2020 at 21:51
19

This worked for me on my mac

brew switch openssl 1.0.2n

1
  • brew switch openssl 1.0.2s worked for me on Catalina. Apr 26, 2020 at 9:46
17

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 👴🏼

3
  • If this works for you, you should consider yourself lucky. The API between 1.0 and 1.1 was pretty different and most things that depend on 1.1 will not work with 1.0. Sep 3, 2020 at 11:16
  • no such file or directory: /usr/local/opt/openssl/lib/
    – AlxVallejo
    Oct 30, 2020 at 13:16
  • I think this is the correct solution. I did this a couple of times and it worked. I just forgot about it and end up here. So, just confirming this is a good solution that is future proof. Just make sure you create the exact erring lib version (1.0.0, 1.0.1, or 1.0.2), depending on the error you are getting. Oct 30, 2020 at 18:21
13
brew reinstall openssl

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

2
  • 1
    This fixed it for me. Thanks. Nov 3, 2020 at 18:36
  • 1
    For all the other solutions, brew seemed to need git (which is what was not working for me). This is the only solution I found that downloads files and installs them without git. Aug 30, 2021 at 19:43
11

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

brew update && brew upgrade
3
  • Simplest solution, openssl was in a correct and up to date version, but the stuff that crashed needed to be updated. Jun 10, 2020 at 15:07
  • Fixed it for me.
    – FloG
    Jun 12, 2020 at 11:27
  • saved my bacon! Jun 25, 2020 at 15:21
11

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.

1
  • 1
    Calling Installation of openssl from a GitHub commit URL is disabled! Use 'brew extract openssl' to stable tap on GitHub instead.
    – AlxVallejo
    Oct 8, 2020 at 21:54
11

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

brew install openssl@1.1
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
2
  • 3
    To inform newcomers here, this doesn't work on M1 with a arm64 build of brew
    – Ovi Trif
    Feb 1, 2022 at 17:41
  • Works for me in MacOS Catalina 10.5.5
    – fguillen
    Apr 6, 2022 at 10:23
10

Proposing brew update && brew upgrade as the solution is not a good answer and, as this error appears in most of the cases due the execution of this...

Switch to the previous version you were using with only: brew switch openssl XXX and that's it.

1
  • 1
    Guys from Google, the actual answer is here.
    – Tony Dinh
    Apr 25, 2020 at 2:07
9

A simple brew update && brew upgrade did the trick for me

0
8

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

2
  • 6
    This worked for me on August 4th, 2020. As a note, the original, accepted answer had worked for me on July 16th, 2019 but did not work today. Aug 5, 2020 at 5:12
  • This worked for me in October 2020. My project uses Symfony 5 Oct 12, 2020 at 15:58
8

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 openssl@1.0.2t

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

6
  • 4
    That was the only solution that did the trick for me. Additionally, I had to create a link so that Vapor would find it: ln -s /usr/local/Cellar/openssl@1.0.2t/1.0.2t /usr/local/opt/openssl Sep 27, 2020 at 21:21
  • No available formula or cask with the name "openssl@1.0.2t"
    – AlxVallejo
    Oct 8, 2020 at 21:49
  • As Andreas stated, you still have to symlink. But Andreas command is backwards. It should actually read ln -s /usr/local/opt/openssl /usr/local/Cellar/openssl@1.0.2t/1.0.2t Oct 30, 2020 at 18:16
  • This worked for me, but you have to do --ignore-dependencies. Dec 1, 2020 at 20:33
  • @LucasC.Feijo can you give the full command with --ignore-dependencies?
    – iCyborg
    Feb 18, 2021 at 21:35
7

If you are using ruby-2.7.0 on MacOS Catalina 10.15

$ brew reinstall openssl@1.1

or

$ rvm reinstall 2.7.0
$ brew tap --repair
$ brew doctor
1
  • this hint saved me hours and hours, great advice for Mac users! Aug 18, 2020 at 16:47
7

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.

1
  • This worked for me in October 2020. My project uses Symfony 5 Oct 12, 2020 at 15:58
6

This might be a problem because of having the older version of brew and installed byobu which require new dependency in order to solve this problem run the following command

brew update && brew upgrade
brew uninstall openssl; brew uninstall openssl; brew install https://github.com/tebelorg/Tump/releases/download/v1.0.0/openssl.rb
0
4

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 openssl@1.1

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

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

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

3

I had a similar issue and based on this and other comments here's what happened and worked:

➜ brew update && brew upgrade && brew install openssl
remote: Repository not found.
fatal: repository 'https://github.com/Homebrew/homebrew-dupes/' not found
Error: homebrew/homebrew-dupes does not exist! Run `brew untap homebrew/homebrew-dupes` to remove it.
...
➜ brew untap homebrew/homebrew-dupes
➜ brew update && brew upgrade && brew install openssl

This was after working on it for hours, but first time I saw the homebrew-dupes. Not sure how Homebrew knew what to install, but it seemed to install everything from scratch. macOS Catalina, zsh. I think the initial problem came because of Catalina

The error I was getting was:

dlopen(/Users/gscar/.gem/ruby/2.7.0/gems/pg-1.2.2/lib/pg_ext.bundle, 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
  Reason: image not found - /Users/gscar/.gem/ruby/2.7.0/gems/pg-1.2.2/lib/pg_ext.bundle
3

If you don't have Homebrew or don't know what is it

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew update && brew upgrade
brew uninstall openssl; brew uninstall openssl; brew install https://github.com/tebelorg/Tump/releases/download/v1.0.0/openssl.rb

Or if you already have Homebrew installed

brew update && brew upgrade
brew uninstall openssl; brew uninstall openssl; brew install https://github.com/tebelorg/Tump/releases/download/v1.0.0/openssl.rb

This works for me on Mac 10.15

1
  • very good this worked for me.. when all the rest failed..lol thanks Aug 13, 2020 at 19:48
3

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.

3

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 openssl@1.0.2t
ln -s /usr/local/Cellar/openssl@1.0.2t/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/formula@version.rb. 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.
2

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
2
  • 3
    invalid option: --upgrade
    – AlxVallejo
    Jun 24, 2020 at 17:55
  • @AlxVallejo brew upgrade openssl
    – xTomasM
    Nov 21, 2022 at 15:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.