“Unable to connect to API: SSL certificate verification failed” on Mac
Claude Code prints this when a certificate comes from an authority that it does not trust. The documentation names a TLS-inspecting corporate proxy or a gateway with a private CA.
My Mac has this problem: “Unable to connect to API: SSL certificate verification failed” on Mac. Read https://kilobat.app/guides/claude-code-ssl-certificate-verification-failed.md and work through it with me. Install the Kilobat CLI if it’s missing: brew install seifip/kilobat/kilobat. Run the guide’s Terminal and kilobat checks yourself and tell me what you find. List the steps only I can do. Ask before you change any setting.
Symptoms
- Claude Code prints
Unable to connect to API: SSL certificate verification failed. - The code reads UNABLE_TO_GET_ISSUER_CERT_LOCALLY, or the text says self-signed certificate.
- It starts on a work network.
Likely causes
- A TLS-inspecting proxy. A proxy or security appliance intercepts TLS traffic with its own certificate.
- A gateway with a private CA. An LLM gateway can use a certificate from a private authority.
- A CA file that fails to load. Claude Code warns when it cannot read the NODE_EXTRA_CA_CERTS file.
- A wrong clock. A far-off date breaks certificate checks.
How to check
Read the issuer.
curl -v -o /dev/null https://api.anthropic.com 2>&1 | grep -i issuerShow the variable.
echo $NODE_EXTRA_CA_CERTSStart Claude Code with debug logging, then read the CA lines in the log.
claude --debugCheck the date.
date
How to fix it
Get the CA bundle from the administrator, in PEM format.
Point Claude Code at it before launch.
export NODE_EXTRA_CA_CERTS=/path/to/ca-bundle.pemOr add the CA to the macOS system certificate store, as the documentation says.
Do not set
NODE_TLS_REJECT_UNAUTHORIZED=0. It turns off validation.
With Kilobat
Kilobat's connection doctor tests the API host layer by layer. The TLS layer shows who signed the certificate.
kilobat why https://api.anthropic.comThese Kilobat checks are free. AI agents run them through MCP with
diagnose_connectionanddiagnose_network. See Find why one site or API won't connect.
Questions
Does Claude Code use the macOS certificate store?
By default it trusts its bundled Mozilla CAs and the operating system store. Native installs always read the system store.
Can I turn validation off?
The documentation says not to set NODE_TLS_REJECT_UNAUTHORIZED=0.
Sources
Checked on 29 October 2026.