macOS SSL / TLS Origin: Network OSI layer 6 · Presentation Last updated 18 Nov 2026

Python on macOS: SSL: CERTIFICATE_VERIFY_FAILED unable to get local issuer certificate (run Install Certificates.command)

The python.org installer doesn't use the system keychain, so HTTPS requests fail until you install its CA bundle.

Exact message you may see SSL: CERTIFICATE_VERIFY_FAILED certificate verify failed: unable to get local issuer certificate Python macOSurllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED]>Install Certificates.commandpython.org certificates macOS
Seen on: Python macOS SSL

Meaning

Run /Applications/Python 3.x/Install Certificates.command (installs certifi and links it), or pip install --upgrade certifi and set SSL_CERT_FILE=$(python -m certifi). Don't disable verification with verify=False.

Common causes

  • python.org build without the certificates installed
  • Outdated certifi
  • Corporate proxy root not in certifi
  • Virtualenv created before installing certificates
  • Wrong SSL_CERT_FILE

⚡ Quick fix

  1. Run Install Certificates.command
  2. pip install --upgrade certifi
  3. Export SSL_CERT_FILE=$(python -m certifi)

Detailed fix by platform

Shell

  1. bash
    /Applications/Python\ 3.12/Install\ Certificates.command
    pip install --upgrade certifi
    export SSL_CERT_FILE=$(python -m certifi)

How to diagnose

  1. Installer — python.org?
  2. certifi — Current?
  3. Proxy CA — Added?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Network. Errors that are often confused with or caused by this one (click to open):

ACM region — CloudFront can't use my ACM certificate: it must be requested in us-east-1 (N. Virginia) (SSL / TLS)ACM regionApple Mail — Apple Mail: Cannot Send Message — the SMTP server connection failed / password incorrect (Email / SMTP)Apple Mailcertifi — requests SSLError: CERTIFICATE_VERIFY_FAILED because certifi is outdated (missing a new root CA) (SSL / TLS)certifiConnectionRefusedError [Errno 111] (SMTP) — Python: ConnectionRefusedError: [Errno 111] Connection refused — smtplib connect to localhost:25 (Email / SMTP)ConnectionRefusedErro…Django — Django send_mail: ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] (EMAIL_USE_SSL vs EMAIL_USE_TLS on the wrong port) (Email / SMTP)DjangoEOF occurred in violation of protocol — Python: ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:2396) (SSL / TLS)EOF occurred in viola…HTTPSConnectionPool: Max retries exceeded (SSLError) — Python requests: HTTPSConnectionPool(host='api.example.com', port=443): Max retries exceeded with url: /v1 (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] ...'))) (SSL / TLS)HTTPSConnectionPool: …security level — Python/OpenSSL: SSLV3_ALERT_HANDSHAKE_FAILURE or CA_MD_TOO_WEAK — OpenSSL security level 2 rejects legacy servers (SSL / TLS)security levelmacOS

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.