Fixing That Nasty "SSL module is not available" Bug on macOS

Got comments?
Fixing That Nasty "SSL module is not available" Bug on macOS

Messing up with Xcode is a recipe for disaster. I knew this when I installed an Xcode Beta alongside an existing version of Xcode. Suddenly, one of my Python apps stopped working with the following error:

Could not fetch URL xyz ... (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available."))

What the ... ?!? Copying Xcode tools around must have messed up the shared libraries. Specifically, with OpenSSL. Although, I seem to have previously installed a version of OpenSSL using Homebrew, it must have been overridden by Xcode's CLI tools setup. To make things even more interesting, it looks like macOS won't even ship with OpenSSL, but a different implementation (LibreSSL), which not all apps are compatible with. It's a mess.

Thankfully, I found a temporary solution. There is a Homebrew tap that installs OpenSSL 1.0 (unlike 1.1, which also doesn't seem to be widely supported). All we need to do is the following:

brew uninstall --ignore-dependencies openssl; brew install 

make sure you have that --ignore-dependencies flag set there, otherwise you'd cause brew to delete everything that depends on OpenSSL (which is frankly, everything).

Afterwards, things should be working normally again. At least, they did for me.

The Missing Package Manager for macOS (or Linux).