“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.

Fix this with your agentCopies a prompt for Claude Code, Codex or any agent that can use Terminal.

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.

Applies to: Claude Code in a terminal on all current macOS versions.Checked: 29 October 2026

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

  1. Read the issuer.

    curl -v -o /dev/null https://api.anthropic.com 2>&1 | grep -i issuer
  2. Show the variable.

    echo $NODE_EXTRA_CA_CERTS
  3. Start Claude Code with debug logging, then read the CA lines in the log.

    claude --debug
  4. Check the date.

    date

How to fix it

  1. Get the CA bundle from the administrator, in PEM format.

  2. Point Claude Code at it before launch.

    export NODE_EXTRA_CA_CERTS=/path/to/ca-bundle.pem
  3. Or add the CA to the macOS system certificate store, as the documentation says.

  4. Do not set NODE_TLS_REJECT_UNAUTHORIZED=0. It turns off validation.

With Kilobat

  1. Kilobat's connection doctor tests the API host layer by layer. The TLS layer shows who signed the certificate.

    kilobat why https://api.anthropic.com
  2. These Kilobat checks are free. AI agents run them through MCP with diagnose_connection and diagnose_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.