“UNABLE_TO_GET_ISSUER_CERT_LOCALLY” on Mac

UNABLE_TO_GET_ISSUER_CERT_LOCALLY means that Node.js cannot find the authority that signed a certificate. A TLS-inspecting proxy or a private authority is the usual cause.

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_GET_ISSUER_CERT_LOCALLY” on Mac. Read https://kilobat.app/guides/npm-unable-to-get-issuer-cert-locally.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: Node.js, npm and tools built on Node.js, on all current macOS versions.Checked: 29 October 2026

Symptoms

  • A Node.js tool stops with UNABLE_TO_GET_ISSUER_CERT_LOCALLY.
  • The message may say unable to get local issuer certificate.
  • Browsers may open the same site.

Likely causes

  • A TLS-inspecting proxy. A work proxy signs traffic with its own certificate. See Corporate proxy certificates break Terminal tools on a Mac.
  • A private authority. A company registry or gateway uses a certificate from an authority that Node.js does not know.
  • A security app that scans HTTPS. It adds its own root, which Node.js does not use by default.
  • A missing intermediate. A server may omit part of its certificate chain.

How to check

  1. Read the issuer.

    curl -v -o /dev/null https://registry.npmjs.org/ 2>&1 | grep -i issuer
  2. Show the CA file that npm uses.

    npm config get cafile
  3. Show the Node.js CA variable.

    echo $NODE_EXTRA_CA_CERTS
  4. Try a phone hotspot.

How to fix it

  1. Get the CA certificate from the network administrator, in PEM format.

  2. Tell Node.js to trust it for this shell.

    export NODE_EXTRA_CA_CERTS=/path/to/ca.pem
  3. For npm, set the same file.

    npm config set cafile /path/to/ca.pem
  4. Do not set NODE_TLS_REJECT_UNAUTHORIZED=0. It turns off all checks.

With Kilobat

  1. Kilobat's connection doctor tests the host layer by layer. The TLS layer shows a certificate that this Mac does not trust.

    kilobat why https://registry.npmjs.org/
  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

Why does the browser work?

macOS trusts certificates that an administrator installs. Node.js uses its own list unless you add a file.

Is setting NODE_TLS_REJECT_UNAUTHORIZED=0 a fix?

No. It turns off certificate validation for every connection. Add the CA instead.

Sources

Checked on 29 October 2026.