Source: https://swgbar.com/en/guides/swg-tls-certificate-errors-macos/
Language: en

# Fix SWG TLS & SSL certificate errors in CLI and AI tools on a Mac

Troubleshoot CERTIFICATE\_VERIFY\_FAILED and local issuer certificate errors in git, npm, Python, Claude Code, and Cursor behind an SWG on macOS.

SWG bar · Updated November 18, 2026

When a company Mac sits behind a Secure Web Gateway (SWG) performing **HTTPS/SSL inspection (break-and-inspect)**, Safari and Chrome often load websites without a warning while Terminal tools and AI coding agents fail with TLS handshake errors such as `SSL: CERTIFICATE_VERIFY_FAILED`, `UNABLE_TO_GET_ISSUER_CERT_LOCALLY`, or `SSL certificate problem: unable to get local issuer certificate`.

This mismatch happens because browsers consult **macOS Keychain**—where MDM can install your organization’s inspection root CA—whereas many command-line runtimes (`git`, `curl`, `Node.js`/`npm`, `Python`/`pip`) and AI tools (`Claude Code`, `Cursor`, MCP servers) validate certificates against their own bundled public CA stores.

## 1\. Confirm which hostname is undergoing HTTPS inspection

Before changing environment variables or network settings, verify whether the failing endpoint’s certificate chain is actually being replaced on your Mac:

1.  [Install and open SWG bar](<https://swgbar.com/en/install/>) on macOS 14 or later (Apple silicon).
2.  Run the failing command once, then check **SWG bar → Domains**—or probe the exact endpoint directly from Terminal using the bundled [CLI](<https://swgbar.com/en/cli/>):

```
/Applications/SWGBar.app/Contents/MacOS/swgbar probe registry.npmjs.org
/Applications/SWGBar.app/Contents/MacOS/swgbar domains detail registry.npmjs.org
```

3.  Inspect the classification and root CA. Remember that web frontends, authentication servers, package registries, and LLM API endpoints often use different hostnames—one subdomain may pass through untouched while another is decrypted.

If you use an MCP-compatible assistant, you can also connect [SWG bar’s built-in MCP server](<https://swgbar.com/en/mcp/>) so your AI client can query observed domains and certificate chains directly.

## 2\. Choose the right fix for your environment

Once you confirm that an inspection root CA is signing the target hostname’s certificate, choose one of three approaches depending on your network policy and authorization:

| Approach | How it works | Best when |
| --- | --- | --- |
| **Configure CA trust for the tool** | Point the runtime (for example `NODE_EXTRA_CA_CERTS`, `SSL_CERT_FILE`, or `REQUESTS_CA_BUNDLE`) to an exported PEM bundle that includes the corporate root CA. | Corporate policy requires inspected SWG routing and you trust that CA for the specific tool. |
| **Request an admin TLS inspection exception** | IT excludes the API or registry hostname from HTTPS decryption on the gateway while keeping gateway routing. | Certificate-pinned tools or team-wide developer endpoints break under break-and-inspect. |
| **Enable per-domain SWG bypass in SWG bar** | Routes the selected hostname on macOS without gateway HTTPS decryption via menu bar, CLI, or MCP. | You administer or are authorized to test an uninspected route for specific domains on your Mac. |

Read [SWG bypass vs. TLS inspection exception](<https://swgbar.com/en/guides/swg-bypass-vs-tls-exception/>) for a detailed architectural comparison of gateway exceptions and route changes.

## 3\. Bypass an inspected domain on macOS when authorized

If per-domain bypass is appropriate for your network, you can enable it for the exact API or registry hostname from the menu bar (**SWG bar → Domains → Bypass SWG → Enable**) or from Terminal:

```
/Applications/SWGBar.app/Contents/MacOS/swgbar bypass enable registry.npmjs.org
/Applications/SWGBar.app/Contents/MacOS/swgbar bypass status
```

After the status shows **Bypassing**, restart the CLI command, background daemon, or IDE extension host so existing connections close and reconnect over the new rule. Follow [How to bypass SWG on a Mac](<https://swgbar.com/en/guides/how-to-bypass-swg/>) for first-time macOS network extension approval, restart behavior, and how to turn bypass off when finished.

## Keep platform and network boundaries in mind

*   **Per-hostname scope**: Bypassing `example.com` does not automatically include `api.example.com` or `auth.example.com`. Check each hostname your tool contacts.
*   **Network requirements**: SWG bar 2.4.12 requires macOS 14+ on Apple silicon and an available IPv4 path over a physical network interface. If a firewall blocks direct outbound connections or the tool enforces its own explicit proxy, disable the bypass rule and use an administrator TLS exception or CA bundle configuration instead.
*   **Verify with fresh evidence**: Run a fresh check using [the HTTPS & SSL inspection guide](<https://swgbar.com/en/guides/detect-https-inspection/>) after any change rather than relying on cached results.

## Keep reading

*   [How to Bypass SWG on a Mac (One-Click Domain Bypass & CLI)](<https://swgbar.com/en/guides/how-to-bypass-swg/>)
*   [How to Bypass SSL Inspection on a Mac (Corporate SWG & Per-Domain Fix)](<https://swgbar.com/en/guides/bypass-ssl-inspection-mac/>)
*   [How to Bypass HTTPS & TLS Inspection on macOS (Break-and-Inspect Guide)](<https://swgbar.com/en/guides/bypass-https-tls-inspection-mac/>)
*   [How to Bypass Corporate Proxy & SWG SSL Inspection on a Mac](<https://swgbar.com/en/guides/bypass-corporate-proxy-ssl-inspection-mac/>)
*   [How to tell if your Mac is intercepted by an SWG (HTTPS & SSL inspection)](<https://swgbar.com/en/guides/detect-https-inspection/>)
*   [How to Check if Your Employer or Work Mac Is Intercepting HTTPS (SSL Inspection)](<https://swgbar.com/en/guides/check-if-work-mac-intercepting-https/>)
*   [SSL Inspection Checker for Mac: Menu Bar Tool to Detect HTTPS Interception](<https://swgbar.com/en/guides/ssl-inspection-checker-mac/>)
*   [Zscaler SSL Inspection on Mac: How to Check & Bypass per Domain](<https://swgbar.com/en/guides/zscaler-ssl-inspection-bypass-mac/>)
*   [Netskope SSL Inspection on Mac: Check Decryption & Bypass per Domain](<https://swgbar.com/en/guides/netskope-ssl-inspection-bypass-mac/>)
*   [Cloudflare WARP & Zero Trust TLS Inspection on Mac: Detect & Bypass](<https://swgbar.com/en/guides/cloudflare-warp-tls-inspection-mac/>)
*   [Confirmed vs. Suspected HTTPS inspection in SWG bar](<https://swgbar.com/en/guides/confirmed-vs-suspected-https-inspection/>)
*   [Inspect MITM root certificates & issuers in SWG bar](<https://swgbar.com/en/guides/inspect-mitm-root-certificates-macos/>)
*   [Enterprise SWG & MDM HTTPS inspection on a Mac](<https://swgbar.com/en/guides/enterprise-swg-https-inspection-macos/>)
*   [SWG bypass vs. TLS inspection exception (break and inspect)](<https://swgbar.com/en/guides/swg-bypass-vs-tls-exception/>)
*   [Bypass SWG for multi-domain web apps, SSO, CDNs & APIs on Mac](<https://swgbar.com/en/guides/multi-domain-sso-api-cdn-swg-bypass/>)
*   [Fix SWG bypass Recovering, Paused & connection errors on Mac](<https://swgbar.com/en/guides/troubleshoot-swg-bypass-recovering-paused-macos/>)
*   [macOS VPN virtual interfaces vs. SWG HTTPS inspection](<https://swgbar.com/en/guides/macos-vpn-virtual-interface-vs-swg-inspection/>)
*   [Why certificate-pinned apps & mTLS break under SWG inspection](<https://swgbar.com/en/guides/certificate-pinning-mtls-swg-inspection-macos/>)
*   [Homebrew, Docker, Python & Node.js CA trust behind an SWG on Mac](<https://swgbar.com/en/guides/homebrew-docker-python-node-ca-trust-swg-macos/>)
*   [Fix Claude Code & Cursor 'unable to get local issuer certificate' on Mac (SWG & MCP)](<https://swgbar.com/en/guides/ai-coding-agents-claude-code-cursor-swg-macos/>)
*   [Verify TLS certificates with openssl & security verify-cert on Mac](<https://swgbar.com/en/guides/verify-tls-certificates-openssl-security-verify-cert-macos/>)
*   [SWG bar permissions, local privacy & TLS probe limits](<https://swgbar.com/en/guides/macos-network-extension-privacy-probe-limits/>)
*   [How SWG bar checks HTTPS inspection](<https://swgbar.com/en/how-it-works/>)
*   [Download & install SWG bar for Mac (macOS 14+)](<https://swgbar.com/en/install/>)
*   [Chrome Extension to Detect SSL & HTTPS Inspection (SWG Bar Companion)](<https://swgbar.com/en/chrome-extension/>)
*   [SWG bar CLI Guide](<https://swgbar.com/en/cli/>)
*   [SWG bar MCP Guide](<https://swgbar.com/en/mcp/>)
*   [SWG bar release information](<https://swgbar.com/en/releases/>)
*   [About SWG bar](<https://swgbar.com/en/about/>)
