Skip to content

Instantly share code, notes, and snippets.

@llbbl
Last active November 3, 2023 06:05
Show Gist options
  • Save llbbl/c54f44d028d014514d5d837f64e60bac to your computer and use it in GitHub Desktop.
Save llbbl/c54f44d028d014514d5d837f64e60bac to your computer and use it in GitHub Desktop.
fix missing openssl files in catalina
#!/bin/bash
echo 'update brew'
brew update
echo 'upgrade brew'
brew upgrade
echo 'brew install openssl'
brew install [email protected]
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/[email protected]/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/[email protected]/1.1.1d/lib/libssl.1.1.dylib ]; then
sudo ln -s /usr/local/Cellar/[email protected]/1.1.1d/lib/libssl.1.1.dylib /usr/local/lib/libssl.dylib
fi
if [ -f /usr/local/Cellar/[email protected]/1.1.1d/lib/libcrypto.1.1.dylib ]; then
sudo ln -s /usr/local/Cellar/[email protected]/1.1.1d/lib/libcrypto.1.1.dylib /usr/local/lib/libcrypto.dylib
fi
@hulleyrob
Copy link

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

"cd /usr/local/Cellar/[email protected]/1.1.1g/lib"

and it works then change line 17 to match it.

@hulleyrob
Copy link

Does that folder exist for you when you into it?

@hulleyrob
Copy link

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
Copy link

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
Copy link
Author

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
Copy link
Author

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
Copy link

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
Copy link

cd /usr/local/lib
ln -sn ../Cellar/[email protected]/1.1.1g/lib/libcrypto.1.1.dylib libcrypto.dylib
ln -sn ../Cellar/[email protected]/1.1.1g/lib/libssl.1.1.dylib libssl.dylib

would be enough, no need to copy

@MikaelX
Copy link

MikaelX commented Sep 17, 2020

cd /usr/local/lib
ln -sn ../Cellar/[email protected]/1.1.1g/lib/libcrypto.1.1.dylib libcrypto.dylib
ln -sn ../Cellar/[email protected]/1.1.1g/lib/libssl.1.1.dylib libssl.dylib

would be enough, no need to copy

This solved my issue perfectly! Thank you

@vutran0111
Copy link

cd /usr/local/lib
ln -sn ../Cellar/[email protected]/1.1.1g/lib/libcrypto.1.1.dylib libcrypto.dylib
ln -sn ../Cellar/[email protected]/1.1.1g/lib/libssl.1.1.dylib libssl.dylib

would be enough, no need to copy

You save my day, thank you so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment