Fix Claude Code & Cursor 'unable to get local issuer certificate' on Mac (SWG & MCP)
Fix Claude Code and Cursor unable to get local issuer certificate errors behind Zscaler, Netskope, or corporate SWGs on macOS—plus connect SWG bar MCP and per-domain bypass.
SWG bar · Updated
If Claude Code, Cursor, Windsurf, or Claude Desktop fails on your work Mac with unable to get local issuer certificate, UNABLE_TO_GET_ISSUER_CERT_LOCALLY, self-signed certificate in certificate chain, or CERTIFICATE_VERIFY_FAILED, your corporate Secure Web Gateway (such as Zscaler, Netskope, or Cloudflare Gateway) is performing SSL/HTTPS inspection and re-signing API responses with an enterprise root CA that Node.js and Electron runtimes do not trust by default.
Below are the two safe fixes on macOS—configuring enterprise CA trust (NODE_EXTRA_CA_CERTS / Cursor system certificates) or enabling per-domain SWG bypass on authorized networks—plus how to connect SWG bar’s built-in MCP server so your AI coding agent can diagnose inspected domains automatically.
1. Confirm which LLM or registry hostnames are intercepted
Before editing shell profiles or settings, verify which exact hostnames (api.anthropic.com, api2.cursor.sh, registry.npmjs.org, OAuth sign-in hosts, or MCP endpoints) are being re-signed on your Mac using SWG bar → Domains or the --json CLI:
swgbar overview --json
swgbar domains list --status confirmed --json
swgbar probe api.anthropic.com --json
swgbar domains detail registry.npmjs.org --json
Pay close attention to secondary endpoints: an AI IDE often contacts separate hostnames for model inference, authentication, telemetry, and extension marketplaces.
2. Fix unable to get local issuer certificate in Claude Code & Cursor
Avoid setting NODE_TLS_REJECT_UNAUTHORIZED=0, which disables TLS validation globally and exposes API keys on untrusted networks. Choose one of the two safe paths below:
Option A: Configure enterprise root CA trust (keeps SWG decryption active)
Export your corporate/Zscaler/Netskope root CA as a PEM file (for example $HOME/.certs/corporate-ca.pem) from Keychain Access or IT, then configure each tool:
- Claude Code (
~/.zshrcand~/.claude/settings.json):
export NODE_EXTRA_CA_CERTS="$HOME/.certs/corporate-ca.pem"
{
"env": {
"NODE_EXTRA_CA_CERTS": "/Users/<your-user>/.certs/corporate-ca.pem",
"CLAUDE_CODE_CERT_STORE": "bundled,system"
}
}
- Cursor (
Preferences: Open User Settings (JSON)): Enable system certificates (and optionally disable HTTP/2 if the SWG proxy breaks streaming), then fully quit (Cmd + Q) and relaunch Cursor from Terminal so it inheritsNODE_EXTRA_CA_CERTS:
{
"http.experimental.systemCertificatesV2": true,
"cursor.general.disableHttp2": true
}
For Zscaler, Netskope, and Cloudflare-specific CA bundle commands, also see Zscaler SSL inspection on Mac, Netskope SSL inspection on Mac, and Fix SWG TLS & SSL certificate errors in CLI and AI tools.
Option B: Enable per-domain SWG bypass on an authorized Mac
When working on a network you administer or are authorized to configure—especially if HTTP/2 streaming or certificate pinning still breaks even with NODE_EXTRA_CA_CERTS—toggle per-hostname bypass over your Mac’s physical Hardware IPv4 interface via SWG bar → Domains → Bypass SWG → Enable or Terminal:
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 existing sockets reopen cleanly. If your corporate firewall blocks direct outbound connections, disable bypass (swgbar bypass disable <domain>) and use Option A or request an IT Do Not Decrypt rule. Follow How to bypass SWG on a Mac for full setup and restart behavior.
3. Connect SWG bar MCP to Claude Code or Cursor
Ensure SWG bar is installed in /Applications/SWGBar.app and running on macOS 14+ (Apple silicon). Register the local stdio MCP server with one command for Claude Code:
claude mcp add swgbar -- /Applications/SWGBar.app/Contents/MacOS/swgbar mcp
Or add the server block to .cursor/mcp.json (for Cursor) or claude_desktop_config.json (for Claude Desktop):
{
"mcpServers": {
"swgbar": {
"command": "/Applications/SWGBar.app/Contents/MacOS/swgbar",
"args": ["mcp"]
}
}
}
See the full MCP guide for all exposed tool areas (Overview, Domains, Certificates, SWG Bypass, On-Demand Probes, Browser Companion, and App Preferences).
Keep local evidence boundaries in mind
SWG bar’s MCP server runs locally over stdio against your Mac’s local database—nothing is sent to SWG bar cloud servers. Still, avoid pasting raw company root CA details or private internal hostnames into public bug reports; review SWG bar permissions & local privacy before sharing diagnostic logs.