You set up Claude Code or open Cursor on your company MacBook, send your first prompt—or run npm install or git push—and immediately hit a wall:

  • unable to get local issuer certificate
  • UNABLE_TO_GET_ISSUER_CERT_LOCALLY
  • self-signed certificate in certificate chain
  • SSL: CERTIFICATE_VERIFY_FAILED

Meanwhile, Safari and Chrome open api.anthropic.com, github.com, and registry.npmjs.org without a single warning.

That discrepancy is almost always caused by corporate HTTPS break-and-inspect from a Secure Web Gateway (SWG) such as Zscaler, Netskope, Cloudflare Zero Trust, or Palo Alto GlobalProtect. Here is why your browser succeeds while your AI coding tools and CLIs break, and how to fix it cleanly on macOS without reaching for insecure shortcuts like NODE_TLS_REJECT_UNAUTHORIZED=0.

Why browsers work while AI coding tools and CLIs fail

When an enterprise SWG inspects encrypted web traffic, it terminates the outbound TLS connection at the gateway, inspects the payload, and re-signs the response with an enterprise Root CA pushed to your Mac via MDM into macOS Keychain.

Safari and Chrome read macOS Keychain automatically, so they silently accept the gateway's re-signed leaf certificates. Developer runtimes do not behave uniformly:

Tool / Runtime Default macOS Trust Store Safe CA Configuration
Claude Code / Node.js / npm / pnpm Compiled-in Mozilla CA bundle NODE_EXTRA_CA_CERTS (appends to bundle)
Cursor / VS Code (Electron) Electron + Chromium/Node split http.experimental.systemCertificatesV2 + NODE_EXTRA_CA_CERTS
Git (Homebrew OpenSSL build) OpenSSL CA bundle git config --global http.sslCAInfo (replaces bundle)
Python / pip / uv / requests certifi or OpenSSL CA path SSL_CERT_FILE / REQUESTS_CA_BUNDLE (replaces bundle)
curl / Homebrew macOS Secure Transport or OpenSSL CURL_CA_BUNDLE (check curl --version)

Because Node.js, Electron helper processes, Python, and OpenSSL-linked Git ignore macOS Keychain by default, the moment your SWG intercepts an LLM API or package registry, certificate validation fails.

Step 1: Verify which hostnames are actually intercepted

Modern AI coding workflows talk to more than one domain—inference APIs, OAuth sign-in endpoints, extension marketplaces, MCP servers, and package registries may not all be treated identically by your SWG policy. Confirm the live issuer before changing configs:

# Inspect the live TLS issuer and subject for an endpoint openssl s_client -connect api.anthropic.com:443 -servername api.anthropic.com \ </dev/null 2>/dev/null \ | openssl x509 -noout -issuer -subject -fingerprint -sha256 

If the issuer= line shows your company name or a gateway vendor (such as Zscaler, Netskope, or Cloudflare Gateway) instead of a public CA like DigiCert, Google Trust Services, or Let's Encrypt, TLS inspection is active on that hostname.

To audit all intercepted hostnames across your Mac at once—without manually guessing secondary auth or CDN hosts—you can also query them locally with the SWG bar CLI on macOS 14+ (Apple silicon):

swgbar domains list --status confirmed --json swgbar probe api.anthropic.com --json swgbar domains detail registry.npmjs.org --json 

Step 2: Export your enterprise Root CA and build a clean bundle

Resist the urge to put export NODE_TLS_REJECT_UNAUTHORIZED=0 in ~/.zshrc or set git config --global http.sslVerify false. Disabling certificate verification globally strips TLS authenticity checks across every API key, OAuth token, and package download—turning any coffee-shop Wi-Fi or misconfigured proxy into a silent credential leak.

Instead, export your corporate Root CA from the macOS System Keychain (or obtain the official PEM file from your IT security team):

mkdir -p ~/.certs # Replace "Zscaler" with the exact issuer CN observed in Step 1 security find-certificate -a -c "Zscaler" -p /Library/Keychains/System.keychain \ > ~/.certs/corporate-ca.pem # Sanity-check that the exported PEM contains valid certificate(s) grep -c "BEGIN CERTIFICATE" ~/.certs/corporate-ca.pem openssl x509 -in ~/.certs/corporate-ca.pem -noout -subject -issuer -dates 

One subtle macOS gotcha: NODE_EXTRA_CA_CERTS appends to Node's built-in public CA list, whereas SSL_CERT_FILE, REQUESTS_CA_BUNDLE, CURL_CA_BUNDLE, and git http.sslCAInfo replace the trust store. If you point Git or Python to a PEM file that only contains your corporate root, any domain excluded from SWG inspection will suddenly fail validation.

Build a combined bundle using macOS's system root bundle so both inspected and public-CA domains verify cleanly:

cat /etc/ssl/cert.pem ~/.certs/corporate-ca.pem > ~/.certs/combined-ca.pem 

Step 3: Configure Claude Code, Cursor, npm, Git, and Python

Claude Code, Node.js, and npm

Add NODE_EXTRA_CA_CERTS to ~/.zshrc (note that NODE_EXTRA_CA_CERTS fixes npm, yarn, pnpm, and npx automatically without needing npm config set cafile):

# ~/.zshrc export NODE_EXTRA_CA_CERTS="$HOME/.certs/corporate-ca.pem" 

For Claude Code specifically, also declare the certificate environment in ~/.claude/settings.json so subshells and IDE-spawned sessions inherit it reliably:

{ "env": { "NODE_EXTRA_CA_CERTS": "/Users/<your-user>/.certs/corporate-ca.pem", "CLAUDE_CODE_CERT_STORE": "bundled,system" } } 

Cursor

Open the Command Palette (Cmd + Shift + P) → Preferences: Open User Settings (JSON) and enable macOS system certificates. Many corporate SWGs also stall long-lived HTTP/2 streaming responses used by AI agents, so disabling HTTP/2 often clears hanging completions:

{ "http.experimental.systemCertificatesV2": true, "cursor.general.disableHttp2": true } 

Because GUI apps opened from Spotlight or Dock do not inherit ~/.zshrc variables, fully quit Cursor (Cmd + Q) and launch it from Terminal (open -a Cursor) when verifying NODE_EXTRA_CA_CERTS.

Git, Python, and Homebrew curl

Point runtimes that replace their CA store at the combined PEM bundle:

# ~/.zshrc export SSL_CERT_FILE="$HOME/.certs/combined-ca.pem" export REQUESTS_CA_BUNDLE="$HOME/.certs/combined-ca.pem" export CURL_CA_BUNDLE="$HOME/.certs/combined-ca.pem" # Apply once for Git git config --global http.sslCAInfo "$HOME/.certs/combined-ca.pem" 

Reload your shell (source ~/.zshrc) and re-test. For Docker Desktop VM trust and Homebrew-specific edge cases, see the Homebrew, Docker, Python & Node.js CA trust guide on macOS.

Step 4: When CA trust isn't enough (streaming stalls or pinning)

Even with the right PEM bundle configured, some developer tools still break behind break-and-inspect because of strict certificate pinning, mTLS client auth, or proxy buffering on SSE/WebSocket streams. Choose the right path for your security policy:

Approach How It Works Best Fit
Enterprise CA trust (NODE_EXTRA_CA_CERTS) Keeps SWG decryption active; teaches runtimes to trust the corporate CA. Standard corporate policy where inspection must stay on.
IT TLS exclusion (Do Not Decrypt) Gateway admin excludes specific API/registry hosts from decryption while keeping routing through the SWG. Team-wide breakage on pinned desktop apps or LLM streaming APIs.
Per-domain SWG bypass on Mac Routes only the selected hostname over your Mac's physical Hardware IPv4 interface while corporate apps remain on the SWG. Authorized networks with direct IPv4 egress when debugging or unblocking a specific host.

If you are working on a Mac and network where per-domain bypass is permitted by your organization's acceptable-use policy, you can toggle a single hostname in SWG bar without tearing down your VPN or breaking device posture:

swgbar bypass enable api.anthropic.com swgbar bypass status --json swgbar probe api.anthropic.com --json 

Restart Claude Code or Cursor after Bypassing appears so open keep-alive sockets reconnect cleanly. Keep in mind that bypass rules are strictly per-hostname (bypassing api.anthropic.com does not cover OAuth or npm hosts), and if your corporate firewall blocks direct outbound IPv4 traffic, disable the rule (swgbar bypass disable api.anthropic.com) and request an IT Do Not Decrypt exception instead.

Bonus: Diagnose TLS issues directly inside Claude Code or Cursor via MCP

On macOS 14+ (Apple silicon), SWG bar ships a local stdio MCP server so Claude Code or Cursor can inspect observed domains, verify MITM root CAs, and run on-demand TLS probes directly from your coding session—everything runs locally against your Mac's database with no cloud upload:

claude mcp add swgbar -- /Applications/SWGBar.app/Contents/MacOS/swgbar mcp 

Or add it to .cursor/mcp.json:

{ "mcpServers": { "swgbar": { "command": "/Applications/SWGBar.app/Contents/MacOS/swgbar", "args": ["mcp"] } } } 

(When sharing diagnostic output in public GitHub issues, always scrub internal corporate hostnames and root CA fingerprints.)

For the full troubleshooting checklist—including multi-domain OAuth/API verification and MCP tool reference—check out the Claude Code & Cursor SWG guide on macOS.