“SELF_SIGNED_CERT_IN_CHAIN” in npm on Mac

SELF_SIGNED_CERT_IN_CHAIN means that the certificate chain holds a certificate that no known authority signed. On a work network, a TLS-inspecting proxy is the usual source.

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

My Mac has this problem: “SELF_SIGNED_CERT_IN_CHAIN” in npm on Mac. Read https://kilobat.app/guides/npm-self-signed-cert-in-chain.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: npm on all current macOS versions. The error also appears in other Node.js tools.Checked: 29 October 2026

Symptoms

  • npm install stops with npm error code SELF_SIGNED_CERT_IN_CHAIN.
  • The message says self-signed certificate in certificate chain.
  • It starts on a company network, or after a security app is installed.

Likely causes

  • A TLS-inspecting proxy. The proxy replaces the registry certificate with its own. See Corporate proxy certificates break Terminal tools on a Mac.
  • A security app that scans HTTPS. It can add its own root to the traffic.
  • An old npm. The npm common-errors page says that npm no longer supports its former self-signed certificates.
  • A private registry. A registry with a private authority needs that authority’s certificate.

How to check

  1. Read the issuer of the registry certificate.

    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. Check the npm version.

    npm --version
  4. Try a phone hotspot. If it works, the first network inspects TLS.

How to fix it

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

  2. Point npm at it.

    npm config set cafile /path/to/ca.pem
  3. Update npm if it is old.

    npm install npm -g
  4. Do not set strict-ssl to false. The npm documentation advises against it.

With Kilobat

  1. Kilobat's connection doctor tests the registry 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

Is npm config set strict-ssl false safe?

It turns off the certificate check. The npm documentation advises against it for proxy errors. Add the proxy’s CA instead.

Why does the error appear only at work?

A proxy that inspects TLS signs traffic with its own certificate. Your Mac does not trust it.

Sources

Checked on 29 October 2026.