← All fixes
SSL: CERTIFICATE_VERIFY_FAILED unable to get local issuer certificate (Python on Mac)
#103Review before running
- Turns off a security check
Agents are told to ask you before running anything flagged here.
Error
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate
Why it happens, and why this works
The python.org installer for macOS doesn't use the system certificate store, so HTTPS requests can't verify any certificate until its CA bundle is installed. Corporate proxies that intercept HTTPS cause the same error everywhere.
Fix
On Mac with python.org Python, run the bundled script once: open "/Applications/Python 3.x/Install Certificates.command" (use your version). Or pip install certifi and point at it. Behind a corporate proxy, add the company's root CA (e.g. via SSL_CERT_FILE / REQUESTS_CA_BUNDLE). Don't set verify=False.
Did it work?
No reports yet0 worked0 didn't
Tried it yourself?
Related fixes
Python on Windows: "certificate has expired" for a valid Let's Encrypt site
#20Python urllib on Windows: URLError [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired, for a site whose server certificate is currently valid (Let's Encrypt)
UnboundLocalError: cannot access local variable where it is not associated with a value
#51UnboundLocalError: cannot access local variable 'count' where it is not associated with a value (older Python: local variable 'count' referenced before assignment)
pythonVerifiedNo reports yet
python: command not found (Mac / Linux)
#104zsh: command not found: python