Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
fix missing openssl files in catalina
#!/bin/bash
echo 'update brew'
brew update
echo 'upgrade brew'
brew upgrade
echo 'brew install openssl'
brew install openssl@1.1
echo 'backup existing lib files, if they exist'
if [ -f /usr/local/lib/libssl.dylib ]; then
mv /usr/local/lib/libssl.dylib /usr/local/lib/libssl_bak.dylib
fi
if [ -f /usr/local/lib/libcrypto.dylib ]; then
mv /usr/local/lib/libcrypto.dylib /usr/local/lib/libcrypto_bak.dylib
fi
# Leaving some commands to check directory contents
# ls -al /usr/local/Cellar/openssl@1.1/1.1.1d/lib
# ls -al /usr/local/lib/libssl* && ls -al /usr/local/lib/libcrypto*
echo 'add symlink to missing openssl libs'
if [ -f /usr/local/Cellar/openssl@1.1/1.1.1d/lib/libssl.1.1.dylib ]; then
sudo ln -s /usr/local/Cellar/openssl@1.1/1.1.1d/lib/libssl.1.1.dylib /usr/local/lib/libssl.dylib
fi
if [ -f /usr/local/Cellar/openssl@1.1/1.1.1d/lib/libcrypto.1.1.dylib ]; then
sudo ln -s /usr/local/Cellar/openssl@1.1/1.1.1d/lib/libcrypto.1.1.dylib /usr/local/lib/libcrypto.dylib
fi
@llbbl

This comment has been minimized.

Copy link
Owner Author

@llbbl llbbl commented Oct 15, 2019

@hulleyrob

This comment has been minimized.

Copy link

@hulleyrob hulleyrob commented Oct 29, 2019

Many thanks nothing like doing an upgrade and finding all your automated scripts in Cron stop working.

@etiennedreyer

This comment has been minimized.

Copy link

@etiennedreyer etiennedreyer commented Nov 6, 2019

Awesome, thanks! The sym-linking procedure worked for me using openssl 1.1 from macports.

@sosolidkk

This comment has been minimized.

Copy link

@sosolidkk sosolidkk commented Nov 7, 2019

Thank you! Fixed my problem with python 3.7.5 aborting.

@andresvia

This comment has been minimized.

Copy link

@andresvia andresvia commented Dec 18, 2019

@llbbl you know if this is reported to brew team?

@llbbl

This comment has been minimized.

Copy link
Owner Author

@llbbl llbbl commented Dec 18, 2019

@andresvia no not sure. Would be better for sure if they could fix this in ruby-land with a brew relink. Would be also interesting to figure out how the version numbers got added to critical openssl dependencies. Hopefully this will stop being a problem for everyone in the coming months.

@andresvia

This comment has been minimized.

Copy link

@andresvia andresvia commented Dec 18, 2019

All: Probably look at this issue: wbond/asn1crypto#158 and comment: Homebrew/homebrew-core#44996 (comment)

@llbbl

This comment has been minimized.

Copy link
Owner Author

@llbbl llbbl commented Dec 18, 2019

@andresvia so looks like deleting and/or upgrading asn1crypto to > 1.20 would also fix it? seems like a better approach to patching in some symlinks.

@andresvia

This comment has been minimized.

Copy link

@andresvia andresvia commented Dec 18, 2019

Yes @llbbl.

There are a lot of solutions out there, I'm going to post what worked for me.

At some point the pip3 command installed asn1crypto as dependency for another pip3 package, as mentioned by maintainer fxcoudert before the asn1crypto package is broken for Catalina before version 1.0.0 but pip3 uses cryptography functions, so pip3 also crashes, so it must be blasted manually.

I tried this first:

pip3 uninstall asn1crypto

It failed for me then I blasted the package manually (Python version may be different 3.7 in my case)

mv ~/Library/Python/3.7/lib/python/site-packages/asn1crypto ~/Library/Python/3.7/lib/python/site-packages/nope-asn1crypto-nope

Then I just pip3 installed it again.

pip3 install --upgrade asn1crypto

I had no no more crashes after this.

@cpavlatos

This comment has been minimized.

Copy link

@cpavlatos cpavlatos commented Mar 5, 2020

Worked like a charm.

Although, I did Change the script to reflect a different version of OpenSSL(openssl@1.1):

Change Dir:
cd /usr/local/Cellar/openssl@1.1/1.1.1d/lib

Copy:
sudo cp libssl.1.1.dylib libssl.1.1.dylib /usr/local/lib/
sudo cp libcrypto.1.1.dylib libcrypto.1.1.dylib /usr/local/lib/

Symlinks:
sudo ln -s libssl.1.1.dylib libssl.dylib
sudo ln -s libcrypto.1.1.dylib libcrypto.dylib

@llbbl

This comment has been minimized.

Copy link
Owner Author

@llbbl llbbl commented Mar 7, 2020

Script update looks good @cpavlatos

Maybe we should install specific versions of openssl to future proof the script?

Ex:

brew install openssl@1.1
@cpavlatos

This comment has been minimized.

Copy link

@cpavlatos cpavlatos commented Mar 7, 2020

@MFRWDesign

This comment has been minimized.

Copy link

@MFRWDesign MFRWDesign commented Mar 10, 2020

I'm running Mojave (10.14.6) here but figured I'd add my own 2-cents here:

All I had to do was:
cd /usr/local/Cellar/openssl/1.0.2q/lib
sudo cp libssl.1.0.0.dylib libcrypto.1.0.0.dylib /usr/local/lib/

Just those two commands, and it worked. (My error was slightly different though):

/Users/MYNAME/.rbenv/versions/2.5.1/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:54:in `require': dlopen(/Users/MYNAME/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/openssl-2.1.2/lib/openssl.bundle, 9): Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib (LoadError)
  Referenced from: /Users/MYNAME/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/openssl-2.1.2/lib/openssl.bundle
  Reason: image not found - /Users/MYNAME/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/openssl-2.1.2/lib/openssl.bundle
@llbbl

This comment has been minimized.

Copy link
Owner Author

@llbbl llbbl commented Mar 11, 2020

I updated the script based on @cpavlatos changes. See the version #1 of the script for the Openssl version 1.0.0 (1.0.2t). Please post if anyone has any issues.

@MFRWDesign I decided to go with the version 1.1.x changes because newer is better? Glad to hear you got it working fine with just copying the two *.dylib files.

@hl4

This comment has been minimized.

Copy link

@hl4 hl4 commented Mar 17, 2020

why not link the library directly?

_ change the version number as is in your system. _
sudo ln -s /usr/local/Cellar/openssl@1.1/1.1.1d/lib/libssl.1.1.dylib /usr/local/lib/libssl.dylib
sudo ln -s /usr/local/Cellar/openssl@1.1/1.1.1d/lib/libcrypto.1.1.dylib /usr/local/lib/libcrypto.dylib

@llbbl

This comment has been minimized.

Copy link
Owner Author

@llbbl llbbl commented Mar 17, 2020

@hl4 Certainly possible... but you can symlink to stuff that doesn't exist? We would need to add an if dir exists block before the symlink? With the old school less optimized approach of cd to dir, then run commands, we have added bonus of it failing at the cd step. also I think keeping it simple is easier for everyone to understand? just a simple bash script that hopefully you have to run once! 🍭

@dddiaz

This comment has been minimized.

Copy link

@dddiaz dddiaz commented Mar 26, 2020

Tried the above solution to uninstall asn1crypto and reinstall it, and that fixed the problem for me.

pip3 uninstall asn1crypto
pip3 install --upgrade asn1crypto
@hulleyrob

This comment has been minimized.

Copy link

@hulleyrob hulleyrob commented Apr 27, 2020

Do you get any errors when you run the bash script above?

@llbbl

This comment has been minimized.

Copy link
Owner Author

@llbbl llbbl commented Apr 27, 2020

@andrewyip1 perhaps Python doesn't know about the /usr/local/lib folder? Only thing I can think of, if everything worked fine?

@llbbl

This comment has been minimized.

Copy link
Owner Author

@llbbl llbbl commented Apr 27, 2020

check what version of openssl in this folder, /usr/local/Cellar/openssl@1.1/
if there are issues with the script the brew install step might have installed a new version other than "1.1.1d"

@llbbl

This comment has been minimized.

Copy link
Owner Author

@llbbl llbbl commented Apr 27, 2020

Script needs to be updated to that version and it should work. Let us know if that fixed it ?

@hulleyrob

This comment has been minimized.

Copy link

@hulleyrob hulleyrob commented Apr 28, 2020

it is confusing with seeing the 1.1.dylib in there often but if you try this command

"cd /usr/local/Cellar/openssl@1.1/1.1.1g/lib"

and it works then change line 17 to match it.

@hulleyrob

This comment has been minimized.

Copy link

@hulleyrob hulleyrob commented Apr 28, 2020

Does that folder exist for you when you into it?

@hulleyrob

This comment has been minimized.

Copy link

@hulleyrob hulleyrob commented Apr 28, 2020

id suggest running each part of the script from the command line 1 by 1 and post any errors you get and which command caused the error.

@fengs

This comment has been minimized.

Copy link

@fengs fengs commented May 24, 2020

The backup should be moved before the cp as after cp the system's lib files have already been overwritten by brew installed ones.

@llbbl

This comment has been minimized.

Copy link
Owner Author

@llbbl llbbl commented May 24, 2020

@fengs I think has a pretty good suggestion, but now I am going back and looking at old version I don't see the issue. The system shouldn't be using "libssl.1.1.dylib" and "libcrypto.1.1.dylib". We were doing a backup of the system libs if they existed. The cp would only overwrite "libssl.1.1.dylib" and "libcrypto.1.1.dylib" if they existed.

Well might as well as combine the bottom part of the script as the previous person suggestion. Sorry for the added complexity, but I think adding the if statements might prevent some possible errors and will be good to add.

@llbbl

This comment has been minimized.

Copy link
Owner Author

@llbbl llbbl commented May 24, 2020

OK, I think should be fine for a while now taking into account everyone's suggestions. Won't get ANY errors now for sure. I removed the now unnecessary directory changes.

@greenhouse

This comment has been minimized.

Copy link

@greenhouse greenhouse commented Jun 2, 2020

hello, i had an issue with 'abort 6' when importing 'requests' package after updating to catalina. while searching for a solution, i was lead to this page. unfortunately none of the above worked for me, however...

updating to python 3.8 manually from python.org seemed to solve this issue very easily for me. i had to reinstall all my packages (w/ pip3) as i came across errors, but that wasn't so bad.

i don't see any of my projects having an issue with python3.8 so far (been using 3.7 for a while)

hope this helps someone!
thanks for all the additional suggestions and efforts!

@lihuanshuai

This comment has been minimized.

Copy link

@lihuanshuai lihuanshuai commented Aug 24, 2020

cd /usr/local/lib
ln -sn ../Cellar/openssl@1.1/1.1.1g/lib/libcrypto.1.1.dylib libcrypto.dylib
ln -sn ../Cellar/openssl@1.1/1.1.1g/lib/libssl.1.1.dylib libssl.dylib

would be enough, no need to copy

@MikaelX

This comment has been minimized.

Copy link

@MikaelX MikaelX commented Sep 17, 2020

cd /usr/local/lib
ln -sn ../Cellar/openssl@1.1/1.1.1g/lib/libcrypto.1.1.dylib libcrypto.dylib
ln -sn ../Cellar/openssl@1.1/1.1.1g/lib/libssl.1.1.dylib libssl.dylib

would be enough, no need to copy

This solved my issue perfectly! Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.