While building python from source on a MacOS, I accidntally overwrote the python that came with MacOS, now it doesn\'t have SSL. I tried to build again by running --wi
First of all, MacOS only includes LibreSSL 2.2.7 libraries and no headers, you really want to install OpenSSL using homebrew:
$ brew install openssl
The openssl formula is a keg-only formula because the LibreSSL library is shadowing OpenSSL and Homebrew will not interfere with this. This means that you can find OpenSSL not in /usr/local but in /usr/local/opt/openssl. But Homebrew includes the necessary command-line tools to figure out what path to use.
You then need to tell configure about these. If you are building Python 3.7 or newer, use the --with-openssl switch:
./configure --with-openssl=$(brew --prefix openssl)
If you are building an older release, set the CPPFLAGS and LDFLAGS environment variables:
CPPFLAGS="-I$(brew --prefix openssl)/include" \
LDFLAGS="-L$(brew --prefix openssl)/lib" \
./configure
and the Python configuration infrastructure takes it from there.
Know that now ancient Python releases (2.6 or older, 3.0-3.4) only work with OpenSSL 1.0.x and before, which no longer is installable from homebrew core.