ClashXよくある問題とトラブルシューティング:使用中の問題を素早く解決

ClashX troubleshooting guide cover

はじめにと問題の分類

強力なプロキシツールであるClashXは、日常使用中にさまざまな問題に遭遇する可能性があります。これらの問題は大きく以下のように分類できます:

接続の問題
接続できない
ネットワークの問題
DNSエラー
設定の問題
YAMLエラー
パフォーマンスの問題
低速

このガイドでは、各タイプの問題に対する診断方法と解決策を説明し、正常な動作を素早く回復するのに役立てます。

💡
クイック診断のヒント

トラブルシューティングの前に、ClashXが実行中か、ネットワーク接続が正常か、アプリケーションのプロキシ設定が正しいかを確認することをお勧めします。これらの3点でほとんどの問題が解決します。

接続の問題のトラブルシューティング

接続の問題はClashXで最も一般的な障害です。このセクションでは、これらの問題を診断して解決する方法を説明します。

問題1:接続できない / プロキシが動作しない

Symptoms

  • Applications cannot access the internet
  • Connection timeout errors
  • ClashX is running but has no effect

Troubleshooting Steps

Step 1: Check ClashX Running Status

# Check for a ClashX process in Terminal
ps aux | grep clash

# Example output:
# xxx /Applications/ClashX.app/Contents/MacOS/ClashX

Step 2: Verify System Proxy Settings

Open System Settings → Network → Wi-Fi/Ethernet → Details → Proxies

Ensure the following settings are correct:

  • Web Proxy (HTTP): 127.0.0.1:7890
  • Secure Web Proxy (HTTPS): 127.0.0.1:7890
  • SOCKS Proxy: 127.0.0.1:7891

Step 3: Test Network Connection

# Check whether ClashX is listening on the ports
lsof -i :7890
lsof -i :7891

# Test proxy connection
curl -x http://127.0.0.1:7890 http://www.gstatic.com/generate_204
⚠️
Common Causes

• Firewall blocking ClashX
• Proxy port occupied by other applications
• No available nodes in subscription
• macOS version incompatibility

Issue 2: Connection Timeout

Symptoms

  • Connection normal but response slow
  • Large file downloads failing
  • Some websites cannot load

Solution

Increase Connection Timeout

# Edit config.yaml and add the following to the general settings:
protocol: TLS1.2

# TCP connection timeout (seconds)
connect-timeout: 5

# Read timeout (seconds)
read-timeout: 5

# If timeouts continue, try increasing them to:
connect-timeout: 10
read-timeout: 10
💡
Optimization Recommendations

Timeout adjustments should be gradual, starting from default values, increasing by 1-2 seconds each time until the problem is resolved. Excessively high timeouts will affect overall performance.

Issue 3: Intermittent Connection Drops

Symptoms

  • Connection randomly drops during use
  • Need to restart ClashX to recover
  • Particularly unstable during certain times

Solution

  • Update Nodes: Manually update subscription link, remove unstable nodes
  • Switch Protocol: Try different proxy protocols (SS, Trojan, VMess)
  • Check Router: Restart network devices, check connection stability
  • Enable Keep-Alive: Enable TCP Keep-Alive in configuration

Enable Keep-Alive Configuration

proxies:
  - name: "Stable Node"
    type: ss
    server: example.com
    port: 443
    cipher: aes-256-gcm
    password: "password"
    udp: true

    # Enable Keep-Alive
    keep-alive: true

TUNモードの問題

TUNモードはシステムレベルのプロキシで、各アプリケーションの個別設定が不要です。ただし、問題が発生する可能性もあります。

Issue 1: TUN Mode Cannot Be Enabled

Common Errors

Error Code Cause Solution
Permission Denied Insufficient permissions Use administrator account or grant permissions
Device Not Found TUN device initialization failed Restart ClashX or system
Port Already in Use Port already in use Change port or close occupying application
Stack Error Protocol stack conflict Try switching to gvisor or system

Troubleshooting Steps

Check User Permissions

# Check whether the current user is an administrator
id

# Check ClashX permissions
ls -la /Applications/ClashX.app/Contents/MacOS/ClashX

Solutions

  1. Ensure using administrator account
  2. Grant TUN permissions in ClashX settings
  3. Try using gvisor protocol stack (more stable)
  4. Check for conflicts with other VPN software

Issue 2: No Network After Enabling TUN Mode

Symptoms

  • Completely no network after enabling TUN mode
  • Local IP address displays abnormally
  • DNS resolution failed

Quick Recovery

Disable TUN Mode in Terminal

# Force disable TUN
defaults write com.west2online.ClashX tun-enabled -bool false

# Restart ClashX
killall ClashX

Configuration Fix

Correct TUN Configuration Example

tun:
  enable: true
  stack: gvisor          # gvisor recommended
  dns-hijack:
    - any:53             # Hijack all DNS queries
  auto-route: true       # Automatically set routes
  auto-detect-interface: true

# DNS Configuration
dns:
  enable: true
  listen: 127.0.0.1:53
  enhanced-mode: fake-ip
  nameserver:
    - 119.29.29.29
    - 223.5.5.5

Issue 3: TUN Mode Affecting Other Applications

Symptoms

  • Some apps (like iMessage, Apple Music) cannot function normally
  • Local services (like MySQL, Redis) connection failed
  • VoIP apps have no audio

Solution

Create Bypass Rules

# Configure in config.yaml
tun:
  enable: true
  stack: gvisor
  dns-hijack:
    - any:53
  auto-route: true
  auto-detect-interface: true

  # Traffic filters - apps that bypass TUN
  include-apps:
    - com.apple.dt.Xcode
    - com.docker.docker

  # Network interfaces that bypass TUN
  exclude-interfaces:
    - en1
    - en2

サブスクリプションリンクの問題

サブスクリプションリンクはClashXを設定する重要な方法です。一般的なサブスクリプションの問題には、インポート失敗やノードが表示されないなどがあります。

Issue 1: Subscription Import Failed

Symptoms

  • No response after pasting link
  • Displays "Invalid URL"
  • Configuration file empty after import

Troubleshooting Steps

Verify Subscription Link Format

# Check whether the link is valid
curl -I "https://example.com/subscribe"

# Verify the returned content type
curl -I -H "Accept-Encoding: gzip" "https://example.com/subscribe"

Common Causes & Solutions

Issue Check Method Solution
Link expired Check provider notifications Update to new link
URL contains special characters Check for spaces or symbols URL encode or use quotes
Network cannot access Open link in browser Check network or use proxy
Format incompatible View returned content Convert to YAML format

Issue 2: Subscription Update Failed

Symptoms

  • No response when clicking update button
  • Displays "Update failed"
  • Nodes remain old list

Solution

Manual Resubscribe

  1. Delete existing subscription
  2. Clear configuration file
  3. Re-import subscription link
  4. Wait for download to complete
💡
Auto Update Recommendations

Set auto-update interval in ClashX settings. Usually recommended to update every 6 hours, avoid frequent updates.

Issue 3: Nodes Not Displayed in Subscription

Symptoms

  • Subscription imported but no available nodes
  • proxy-groups is empty
  • Rules cannot match

Check Process

Check Configuration File Content

# Open the configuration file
open ~/.config/clash/config.yaml

# Check the following:
# 1. Whether the proxies section has nodes
# 2. Whether proxy-groups is correct
# 3. Whether rules are complete

Common Reasons

  • Subscription link format incompatible with ClashX
  • Node information incomplete or format error
  • Proxy protocol version not supported
  • YAML syntax error
⚠️
Format Requirements

Ensure the format provided by the subscription provider is ClashX compatible. Some providers may require specific User-Agent or port numbers.

パフォーマンス最適化

ClashXのパフォーマンス問題は通常、速度低下、メモリ使用量の増加、CPU使用率の上昇として現れます。

Issue 1: Slow Proxy Speed

Symptoms

  • Slow web page loading
  • Video buffering
  • File download speed lower than normal

Troubleshooting Steps

Test Node Latency

# Run speed tests in ClashX Dashboard
# Or test with the command line tool
curl -x socks5://127.0.0.1:7891 http://www.gstatic.com/generate_204 -w "%{time_total}\n" -o /dev/null

# Check latency to different regions
ping -c 4 8.8.8.8  # Requires proxy settings

Optimization Solutions

  • Select Optimal Node: Use url-test to automatically select lowest latency node
  • Adjust DNS: Use low-latency DNS servers
  • Enable Multiplexing: Enable HTTP/2 on supported protocols
  • Check Local Network: Ensure Wi-Fi signal is stable

Performance Optimization Configuration Example

# Use url-test Auto Select for the fastest nodes
proxy-groups:
  - name: "♻️ Auto Select"
    type: url-test
    proxies:
      - "Node 1"
      - "Node 2"
      - "Node 3"
    url: "http://www.gstatic.com/generate_204"
    interval: 300        # Test once every 5 minutes
    tolerance: 50        # 50ms tolerance

# Optimize DNS configuration
dns:
  enable: true
  enhanced-mode: redir-host  # Better performance than fake-ip
  nameserver:
    - 119.29.29.29       # Fast mainland China DNS
    - 223.5.5.5
  fallback:
    - https://1.1.1.1/dns-query  # Fast international DNS

Issue 2: High Memory Usage

Symptoms

  • ClashX using more than 500MB memory
  • System becomes sluggish
  • Other applications respond slowly

Solution

  • Reduce Node Count: Delete unused nodes and rule sets
  • Disable Unnecessary Features: Turn off Dashboard, TUN mode
  • Optimize Rules: Use rule sets instead of individual rules
  • Regular Restart: Restart ClashX daily to free memory

Monitor Memory Usage

# View ClashX real-time memory usage
top -p $(pgrep ClashX)

# Export memory usage details
ps aux | grep ClashX

Issue 3: High CPU Usage

Symptoms

  • ClashX process CPU usage over 50%
  • Fan spinning fast
  • Battery draining quickly (laptop)

Solution

  • Check Rule Complexity: Too many rules increase CPU burden
  • Disable Fake-IP: Use redir-host mode
  • Limit url-test Frequency: Increase test interval
  • Update to Latest Version: New versions usually have performance optimizations

Reduce CPU Usage Configuration

dns:
  enable: true
  enhanced-mode: redir-host  # Instead of fake-ip

# Reduce log level
log-level: warning

# Lower testing frequency
proxy-groups:
  - name: "♻️ Auto Select"
    type: url-test
    interval: 600  # Increase to 10 minutes

設定ファイルの問題

設定ファイルエラーはClashXが正常に動作しない一般的な原因です。

Issue 1: YAML Syntax Errors

Symptoms

  • Displays "Parse error" or "Invalid config"
  • Configuration file cannot load
  • Some configuration items not taking effect

Common Errors & Fixes

Error Type Example Correct Way
Indentation error Using Tab indentation Use 2 spaces
No space after colon name:test name: test
Special characters not escaped password: pass@123 password: "pass@123"
List format error proxies: node1, node2 proxies:
- node1
- node2

Validate Configuration File

Use Online YAML Validator

Visit yamllint.com or jsoncrack.com to validate configuration file

Or use command line tool:

# Validate YAML using Python
python3 -c "import yaml; yaml.safe_load(open('config.yaml'))"

# No output means the configuration is valid

Issue 2: Configuration Items Not Taking Effect

Symptoms

  • Rules still not applied after modification
  • New proxy nodes not displayed
  • DNS settings invalid

Solution

💡
Configuration Apply Steps

1. Edit configuration file
2. Click "Reload Configuration" in ClashX UI
3. Or restart ClashX application
4. Wait 2-3 seconds for it to take effect

  • Ensure configuration file is saved
  • Use "Reload Configuration" instead of "Enable"
  • Check file permissions are correct
  • View ClashX logs for more information

Issue 3: Configuration File Lost or Corrupted

Symptoms

  • Cannot find configuration file
  • Configuration file cannot open
  • Error when starting ClashX

Recovery Steps

Configuration File Location

# Default macOS location
~/.config/clash/config.yaml

# Open the directory containing the configuration file
open ~/.config/clash/

Recovery Actions

  1. Close ClashX
  2. Backup existing configuration file (if any)
  3. Restore from backup or re-import subscription
  4. Restart ClashX

Other Common Issues

Issue 1: DNS Resolution Failed

Symptoms

  • Cannot access some websites
  • Displays "DNS failed" or "Cannot resolve host"
  • DNS query timeout

Solution

Test DNS

# Test DNS resolution
nslookup google.com

# Use dig for detailed diagnostics
dig google.com @119.29.29.29

# Test DoH (DNS over HTTPS)
curl -H 'Accept: application/dns-json' 'https://dns.google/resolve?name=google.com'

Configuration Optimization

Recommended DNS Configuration

dns:
  enable: true
  listen: 127.0.0.1:53
  enhanced-mode: redir-host

  nameserver:
    - 119.29.29.29       # Tencent DNS
    - 223.5.5.5          # AliDNS
    - 8.8.8.8            # Google DNS

  fallback:
    - https://1.1.1.1/dns-query    # Cloudflare DoH
    - https://dns.google/dns-query # Google DoH

  fallback-filter:
    geoip: true
    geoip-code: CN
    ipcidr:
      - 240.0.0.0/4

Issue 2: SSL/TLS Certificate Errors

Symptoms

  • Displays "Certificate verification failed"
  • Some HTTPS websites cannot access
  • Browser shows certificate untrusted warning

Temporary Solution (Not Recommended)

⚠️
Security Warning

Skipping certificate verification reduces security. Use only in test environments.

Configure Skip Certificate Verification (Debug Only)

proxies:
  - name: "Test Node"
    type: trojan
    server: example.com
    port: 443
    password: "password"
    skip-cert-verify: true  # Not recommended for long-term use

Issue 3: Application Cannot Connect to Proxy

Symptoms

  • A specific app cannot use proxy
  • App shows offline status
  • Other apps work but this one does not

Solution

  • Check App Proxy Settings: App itself may need proxy configuration
  • Allow Local Connections: Enable "Allow LAN" in ClashX
  • Close App Firewall: Some security software may block connections
  • Restart App: Clear cached network connections

Prevention Measures & Best Practices

Many issues can be prevented by following best practices.

Regular Maintenance

  • Weekly Node Updates: Keep latest node list
  • Monthly Log Checks: Discover potential issues early
  • Regular Backups: Prevent configuration file loss
  • Update ClashX: Get latest features and fixes

Configuration Best Practices

  • Keep Configuration Simple: Only configure necessary rules and nodes
  • Use Version Control: Manage configuration files with Git
  • Document Changes: Record the purpose of each configuration item
  • Test New Configurations: Test thoroughly before applying globally

Backup Strategy

Backup Configuration Files

# Create a config backup
cp ~/.config/clash/config.yaml ~/.config/clash/config.backup.yaml

# Back up with Time Machine (macOS)
defaults write com.west2online.ClashX autosyncconfig -bool true

# Regularly check backups
ls -la ~/.config/clash/

Monitoring & Logging

  • Enable detailed log level: log-level: debug
  • Regularly check log file: ~/.config/clash/clashx.log
  • Monitor system resource usage
  • Use Dashboard for real-time monitoring
💡
Problem Prevention Checklist

Recommended monthly checks:
- [ ] Update subscription links
- [ ] Check disk space
- [ ] Verify DNS configuration
- [ ] Backup configuration files
- [ ] Check system updates
- [ ] Test network connection
- [ ] Clean log files