/usr/bin/python3
from Xcode/CLT on macOS 10.15 (DB6/PB5 at the moment, with Xcode 11 beta 6) fails with SSL: CERTIFICATE_VERIFY_FAILED
for all HTTPS re
According to this GitHub issue, Apple refused to fix this:
The problem behaves as intended.
certifi
is a third-party module, not part of Python itself.
urllib
is a low-level library. It can handle SSL, but you must explicitly set up the SSL context with acafile
.Try the following instead:
pip3 install requests python3 -c 'import requests; print(requests.get("https://apple.com").text)'
If you only want to get
cacert.pem
, you can usepip3 install certifi
, but you must still explicitly passcafile
tourllib
.
So my solution is simply using Requests instead. This is supported and future proof.