[BUG] Claude Code ECONNREFUSED on one Mac — all standard troubleshooting exhausted
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Claude Code ECONNREFUSED on one Mac — all standard troubleshooting exhausted
Environment
- Claude Code version: v2.1.87
- OS: macOS (Apple Silicon, Mac Studio M2, 64GB)
- Node.js versions tested: v22.22.0, v24.13.0, v24.14.1, v25.0.0
- Installation methods tested: npm (
@anthropic-ai/claude-code), standalone (curl -fsSL https://claude.ai/install.sh | bash), npx - Auth mode: API Usage Billing (OAuth, Pro/Max subscription)
- Network: Same network as another Mac where Claude Code works fine
Problem
Claude Code consistently fails with Unable to connect to API (ConnectionRefused) / ECONNREFUSED on every attempt, across all installation methods and Node.js versions. Another Mac on the same network with the same account works perfectly (installed via npm).
What works on this Mac
curl -v https://api.anthropic.com/v1/messages→ HTTP 200 (with valid key) / 401 (with test key) — connection succeedscurl -v https://platform.claude.com→ OKcurl -v https://claude.ai/api/auth→ OKnode -e "fetch('https://api.anthropic.com/v1/messages').then(r => console.log(r.status))"→ 405 (OK)nslookup/dig→ api.anthropic.com resolves correctly to 160.79.104.10- Node.js DNS resolve and lookup both return correct IP
What does NOT work
claude(any command includinghello,config list,login,logout) →Unable to connect to API (ConnectionRefused), retries 10 times and fails- Same behavior with npm install, standalone install, and npx
Diagnostic findings
No network activity from Claude Code
lsof -i -n -P | grep node→ nothing (while Claude Code is retrying)NODE_DEBUG=net,tls claude 2>/tmp/debug.log→ no net/tls output at allsudo tcpdump -i lo0→ no loopback traffic- Claude Code appears to never actually attempt a network connection
System is clean
- No proxy configured (
scutil --proxyclean,env | grep proxyempty) /etc/hostshas no anthropic/claude entries (only Parallels-related blocks)- No
NODE_OPTIONSset, no.npmrc, no preload modules - macOS firewall not blocking Node.js
Cleanup attempted (all unsuccessful)
rm -rf ~/.claude— multiple times- Removed
~/Library/Application Support/Claude/claude-code,claude-code-vm,claude-code-sessions - Removed keychain entries for claude/anthropic
- Set
bridge-state.jsonenabled: false - Quit Claude Desktop app (
pkill -f "Claude.app") - Unloaded and removed
ai.openclaw.gatewayLaunchAgent (~/Library/LaunchAgents/ai.openclaw.gateway.plist) - Removed
~/.openclawdirectory - Full uninstall/reinstall of Claude Code via npm and standalone installer
- Tested with Node.js v22, v24, v25
Possibly relevant
- openclaw (
ai.openclaw.gateway) was installed as a LaunchAgent on this Mac. It was removed, but the issue persists. openclaw may have modified Claude Code's behavior or left residual configuration. - Claude Desktop app was running with bridge enabled (
bridge-state.jsonhad"enabled": true). Disabling bridge and quitting Desktop did not help. - After full cleanup, Claude Code still shows "Welcome back!" suggesting credentials are cached somewhere not yet identified.
Request
Guidance on where Claude Code stores its connection endpoint configuration and what could cause it to not even attempt a network connection (no traffic visible in lsof, tcpdump, or NODE_DEBUG). Is there a verbose/debug logging flag we can enable to see exactly what URL/port Claude Code is trying to reach?
What Should Happen?
Claude Code should connect to api.anthropic.com and function normally, as it does on another Mac with the same account on the same network.
Error Messages/Logs
Steps to Reproduce
Install Claude Code via any method on this specific Mac
Run claude
Type any message
Observe: Unable to connect to API (ConnectionRefused), retries 10/10, fails
Claude Model
Sonnet (default)
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.87
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Other
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗