mihomo Core · Configuration Reference

Clash Configuration GuideUnderstand Every YAML Field

From subscription imports to traffic routing, use config.yaml examples to check field hierarchy and see where traffic goes.

  • Open-Source Clients
  • mihomo Core
  • YAML Configuration
  • Chinese Documentation

config.yaml brings together listeners and parsing, proxy nodes, proxy groups, and matching rules.

rules / match order

Traffic Routing: Match a Rule, Choose an Outbound

In rule mode, rules are checked from top to bottom, and the first match determines the outbound. This example uses DOMAIN to send an exact domain to DIRECT, then MATCH to send all remaining connections to PROXY. To match a domain and its subdomains, use DOMAIN-SUFFIX. Put narrower exceptions first. If you move the fallback rule to the top, none of the rules below it will take effect. The override snippet on the right replaces the entire rules list; add new rules before the fallback.

Explore Rule Syntax
mode: rule
rules:
  - DOMAIN,example.org,DIRECT
  - MATCH,PROXY

proxy-groups / selection

Proxy Groups: Manual Selection and Automatic Testing

proxy-groups defines named outbound options for rules to use. In this example, select lets you choose a member manually, while url-test selects one automatically based on test results; interval is measured in seconds. The snippet references a proxy provider named subscription using use; define it first under proxy-providers. If the provider name is misspelled, the group cannot reference its members. If the test URL is unreachable, the results cannot reliably compare candidate outbounds.

Explore Proxy Group Fields
proxy-groups:
  - name: PROXY
    type: select
    use: [subscription]
    proxies: [DIRECT]

override / effective config

Overrides and Merging: Check the Effective Configuration

Use overrides to keep settings such as local ports and LAN access separate from the subscription itself. This example changes mixed-port to 7891 and disables LAN access with allow-lan: false. If you change the port, update any apps that use a manually configured proxy as well. The snippet shows only the top-level fields to change; the client determines how overrides are imported and how nested maps and lists are merged. After applying an override, check the effective configuration to confirm that nodes, proxy groups, and rules are still present, then reload.

Explore Overrides and Merging
mixed-port: 7890
allow-lan: false
mode: rule
log-level: info

clients / platforms

Download a Clash Client for Your OS

Check your operating system and processor architecture before choosing an installer. A GUI client is all you need to import subscriptions, switch nodes, and view connection logs. Run the core separately only if you need to specify a configuration directory or manage a service on a server. Back up configuration files separately; they do not need to be stored with the installer.

Windows

Best for desktop users who want tray controls, configuration management, and a log window. Check your system type under Settings → System → About. Processor architecture and OS bitness are not the same thing. Before switching clients, quit the old one and turn off its system proxy to avoid sending requests to a stale port. Once the new client starts, make sure your browser uses the current listener port. If that port is already in use, identify the process using it instead of enabling two traffic-capture methods at once.

macOS

Best for desktop users who manage subscriptions and outbounds from the menu bar. Check your chip under About This Mac: choose the Apple Silicon build for an Apple chip or the Intel build for an Intel processor. After installation, import and enable a configuration before deciding whether to turn on the system proxy or use a virtual network interface. If the browser works but command-line tools connect directly, check whether those tools read the system proxy settings. Some require a proxy address to be configured separately, so the menu bar toggle alone may not be enough.

Android

Choose a build that matches the device's supported app architecture. A 64-bit processor does not necessarily mean the OS can run 64-bit apps. If you are unsure, check whether the client offers a universal build. On the first connection attempt, the system may ask you to approve a VPN request. If another app already has a VPN active for the same user, disconnect it before trying again. If connections drop only after the screen turns off, check the app's background activity restrictions first; there is no need to switch nodes or DNS right away.

iOS

Open the app store listing from the download page, check the minimum OS requirements, and import the subscription in a format supported by the client. When connecting for the first time, approve the VPN configuration when prompted. The VPN icon only indicates that the system tunnel is active; it does not mean every destination uses the same outbound. In rule mode, test one destination expected to go direct and another expected to use a proxy, then check the client's connection logs for each.

Linux

Desktop users should choose a package for their distribution and processor architecture; the same package format does not work across different architectures. On headless systems, you can run the core on its own. Use uname -m to check the machine architecture reported by the system. Before setting up a persistent service, launch it once in the foreground with the configuration directory you plan to use. If it starts in a terminal but fails as a service, first compare the run user, working directory, and configuration file permissions.

Browse All Clients →

source / effective config

Open-Source Projects and Configuration Sources

If you find clients with similar names or conflicting field examples, first identify the project behind each source and whether it describes the client interface, core behavior, or subscription content.

Get mihomo Source Code

The MetaCubeX/mihomo upstream repository provides source code, commit history, and release notes. The command below only clones the source; it does not install or start the core.

git clone https://github.com/MetaCubeX/mihomo.git

Project History: Clash, Clash.Meta, and mihomo

Early versions of Clash used text-based configuration, keeping listeners, nodes, proxy groups, and rules in one file. The later Clash.Meta fork retained this structure and added fields and protocol support; the project is now known as mihomo. Older guides can help explain the basic configuration hierarchy, but they do not tell you whether today's core supports a newer option, and their client menu paths may not match the current interface. If two sources explain the same field differently, check which core and configuration scenario each one covers, then consult the upstream release notes. This site organizes guidance by configuration task and is not the publisher of any client.

Open-Source Ecosystem: Separate the Interface from the Core

In clients that use mihomo, for example, the interface usually handles importing, updating, and selecting configurations, as well as toggling the system proxy. The core reads the effective configuration and handles listeners, DNS resolution, rule matching, and outbound connections. Importing the same subscription into two clients does not mean they produce identical effective configurations. One client may set local ports in its app settings; another may merge an override file before launch. When troubleshooting, track parse errors, port conflicts, and outbound timeouts separately. A running client process only confirms that the interface is available; check core logs and request results too.

Configuration Flow: Trace a Request from Entry to Outbound

When troubleshooting a request, first confirm that the app actually sends the connection to the core. Then check the matched rule and outbound in the connection details. mixed-port lets HTTP and SOCKS share one local listener port, while port is a dedicated HTTP proxy listener; they are not interchangeable. dns controls how the core handles DNS requests it receives, but enabling it does not mean every app on the system sends DNS queries to the core. After a rule selects a proxy group, check which member the group currently uses. Following this order in the logs helps you tell whether the request never reached the core, took the wrong rule branch, or failed to connect through the expected outbound.

Update Boundaries: Manage the App, Subscription, and Local Settings Separately

Updating a client replaces the app; refreshing a subscription fetches configuration or node data. These are separate operations. To keep local settings over time, use the client's supported override mechanism rather than editing subscription content that may be replaced on the next refresh. Save a known-good configuration first, then change one field or one related set of fields and compare the effective configuration. If a proxy group is empty after an update, check whether its provider refreshed successfully and whether the referenced name still matches. If no apps can connect, check the listener port, system proxy, and core startup logs. When reporting an issue to the community, include the smallest set of fields needed to reproduce it and remove private domains and subscription URLs.

Subscription Formats: Check the Response Before Choosing an Import Method

A subscription link is an address for retrieving content, not a format name. If it returns a complete YAML file, you can usually import it as a configuration. If it returns only a node list, the client must recognize its encoding and node protocols; you will also need suitable proxy groups and rules. If the URL is for a proxy provider, reference it under proxy-providers in an existing configuration instead of importing the provider response as a complete configuration. If a download succeeds but parsing fails, first check whether the response is actually a login page or error message, then check which format the client recognizes. See the subscription import guide for steps.

Verify Changes: Compare the Same Request Before and After

Before loading the new configuration, note one destination expected to go direct and one expected to use a proxy group. After the change, repeat the same requests and check the matched rule, proxy group, and final outbound in the connection logs; a speed test is not a substitute for an actual request. If the browser reuses an existing connection, close the relevant tabs and try again. If the system still uses an old proxy port, correct the app's connection settings before checking routing. If restoring the original configuration resolves the issue, retest port, DNS, and rule changes separately. This helps identify the first field that caused a difference without repeatedly switching clients and network modes in the same test.

notes / recent articles

Clash Configuration and Connection Troubleshooting

Browse All Articles →