Common Causes of Connection Timeout
ClashX connection timeouts are typically caused by the following issues. Understanding the root cause helps you fix the problem quickly:
- Port Conflict — ClashX uses ports 7890 (HTTP) and 7891 (SOCKS5) by default. If another application occupies these ports, ClashX cannot listen for traffic and the proxy will fail.
- DNS Pollution — In certain network environments, DNS requests are hijacked or poisoned, resolving domain names to incorrect IP addresses. This prevents ClashX from reaching the correct proxy server.
- Node Failure — Proxy nodes may become unavailable due to server maintenance, traffic limits, or blocking. This is the most common cause of timeouts.
- Firewall Blocking — The macOS built-in firewall or third-party security software may block ClashX network requests.
Step 1 — Check Port Settings
First, make sure the ports ClashX needs are not occupied by other applications.
Check Port Occupation
Open Terminal and run the following command to check whether port 7890 is in use:
lsof -i :7890
If there is any output, the port is already in use. Check the COMMAND column to identify which program is using it, then close it or change the ClashX port.
Also Check the SOCKS5 Port
lsof -i :7891
View System Proxy Settings
Verify that macOS system proxy points to the correct port:
# Check HTTP proxy settings
networksetup -getwebproxy Wi-Fi
# Check SOCKS proxy settings
networksetup -getsocksfirewallproxy Wi-Fi
Change ClashX Ports
If there is a port conflict, modify the port numbers in the ClashX config file:
# config.yaml
port: 7892 # HTTP proxy port
socks-port: 7893 # SOCKS5 proxy port
Restart ClashX after saving the changes.
Step 2 — Check DNS Configuration
Incorrect DNS configuration is a major cause of connection timeouts.
DNS Leak Test
Visit dnsleaktest.com and run the standard test to check if DNS requests are properly forwarded through the proxy. If your local ISP DNS servers appear, you have a DNS leak.
fake-ip vs redir-host
ClashX supports two DNS enhancement modes:
- fake-ip (recommended) — Returns fake IP addresses, avoiding DNS pollution with faster connections.
- redir-host — Uses real IPs for better compatibility, but may be affected by DNS pollution.
Recommended DNS Configuration
# config.yaml
dns:
enable: true
enhanced-mode: fake-ip
fake-ip-range: 198.18.0.1/16
nameserver:
- https://doh.pub/dns-query
- https://dns.alidns.com/dns-query
fallback:
- https://1.1.1.1/dns-query
- https://dns.google/dns-query
fallback-filter:
geoip: true
geoip-code: CN
Flush DNS Cache
After modifying DNS settings, flush the system DNS cache:
sudo dscacheutil -flushcache
sudo killall -HUP mDNSResponder
Step 3 — Check Node Availability
Node failure is the most common cause of connection timeouts. Use these methods to diagnose quickly.
Latency Test
In the ClashX menu bar, right-click the node list and select "Benchmark" or "Speed Test". Avoid nodes with latency above 500ms or those showing "Timeout".
Switch Nodes
Try switching to a node with lower latency. Prioritize:
- Nodes with latency under 100ms
- Nodes geographically close to your location
- Nodes with lower load during off-peak hours
Update Subscription
If all nodes are timing out, your subscription may have expired. Update it manually:
# Manually update via Terminal (optional)
curl -o ~/.config/clash/config.yaml "YOUR_SUBSCRIPTION_URL"
Or select "Config" → "Update" from the ClashX menu to refresh the configuration.
Advanced Troubleshooting
If the steps above didn't resolve the issue, try these advanced methods.
Firewall & VPN Conflicts
Check if the macOS firewall is blocking ClashX:
# Check firewall status
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --getglobalstate
# Add ClashX to firewall whitelist
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --add /Applications/ClashX.app
If you are running other VPN software (e.g., Tunnelblick, WireGuard), it may cause routing conflicts with ClashX. Disable other VPNs before testing.
TUN Mode
ClashX Pro supports TUN mode (enhanced mode), which takes over all system traffic. If timeouts persist in normal mode, try enabling TUN mode:
# config.yaml (ClashX Pro)
tun:
enable: true
stack: system
auto-route: true
auto-detect-interface: true
System Proxy Verification
Make sure "Set as System Proxy" is enabled in ClashX. You can also verify manually:
# Test if proxy is working
curl -x http://127.0.0.1:7890 https://www.google.com -I
# List all network services
networksetup -listallnetworkservices
Frequently Asked Questions
Q: ClashX keeps showing "Timeout" after startup. What should I do?
A: First check if your internet connection works (can you open domestic websites?). If the network is fine, follow the 3-step method in this article: check ports, DNS, and nodes. In most cases, switching nodes resolves the issue.
Q: Why does it still time out after switching nodes?
A: All nodes may have become unavailable. Try updating your subscription to get new nodes, or contact your service provider to confirm the service status.
Q: Does fake-ip mode affect access to local websites?
A: Not if routing rules are configured correctly. Make sure your config file has proper rules so local domains go through direct connection.
Q: How can I tell if it's a node issue or a local issue?
A: Run ping 127.0.0.1 in Terminal to confirm the local network stack is working, then run curl -x http://127.0.0.1:7890 https://www.google.com to test the proxy. If ping works but curl fails, it's a node issue.