Clash Port Already in Use: Find the 7890 Conflict and Change mixed-port

Find the process using a port with netstat or lsof, change mixed-port or the external-controller port, then update your system proxy settings.

Check the logs first: Is the conflict with the proxy port or the control port?

Open your client’s core logs and find the listening address and port in the error message. bind: address already in use or, on Windows, Only one usage of each socket address indicates a listener conflict. A browser’s ERR_PROXY_CONNECTION_FAILED does not necessarily mean the port is in use; the core may not have started, or the system proxy may still point to an inactive port.

Config fieldExample addressWhat to update after changing it
mixed-port127.0.0.1:7890System proxy, browser, or app-specific HTTP / SOCKS5 proxy settings
external-controller127.0.0.1:9090Management panels or local admin tools with a separately configured API address

The 7890 and 9090 values here are examples for troubleshooting, not defaults for every client. If the logs show 7891, first check the current socks-port setting. If you use a separate HTTP proxy, check port as well. Change only the listener that is actually in conflict; don’t enter the control interface address as your system proxy.

Find the process using port 7890 on Windows, macOS, or Linux

Check for TCP listeners while the error is still reproducible. In addition to 127.0.0.1:7890, check 0.0.0.0:7890 and [::]:7890. Wildcard listeners cover a broader range of addresses, and whether an IPv6 wildcard listener also accepts IPv4 connections depends on the OS and socket settings. Don’t search only for the loopback address.

Windows: Use netstat to find the PID, then identify the process

Run these two commands in PowerShell or Command Prompt. The 4620 in the second command is an example; replace it with the PID in the last column of your results.

netstat -ano -p tcp | findstr ":7890"
tasklist /FI "PID eq 4620"

findstr matches the entire line, so it may also match a remote address or a number such as 78900 that starts with the same digits. Look only for entries where the local address has port 7890 exactly and the state is LISTENING. To check IPv4 and IPv6 together, you can filter by exact local port in PowerShell:

Get-NetTCPConnection -LocalPort 7890 -State Listen |
  Select-Object LocalAddress, LocalPort, OwningProcess

macOS: Use lsof to find the listener

lsof -nP -iTCP:7890 -sTCP:LISTEN

In the results, COMMAND is the process name, PID is its ID, and NAME shows the bound address. -nP keeps addresses and ports numeric, avoiding confusion from name resolution. If your account can’t see another user’s processes, run the check again with sudo.

Linux: Use ss to find local listeners

sudo ss -ltnp 'sport = :7890'

-ltnp lists listening TCP sockets, shows addresses and ports as numbers, and includes process details. Check Local Address:Port and users: to identify the process using the port. To check the control interface, replace 7890 in the command above with the control port from the logs, such as 9090.

If you find an old Clash or mihomo instance, quit it from the tray menu or stop it in the service manager that launched it, then check the port again. Closing the window often just hides the app. If the process belongs to an app you still need, leave it running and assign a different port to the current client.

Change mixed-port and external-controller

For example, change the proxy port from 7890 to 17890 and the control port from 9090 to 19090. First check the target ports with the same commands, then decide which field to change. Finding no listener is only a first check; confirm the core binds successfully after restarting.

  1. Identify the active config source. Graphical clients often merge subscriptions, UI settings, and overrides at startup. If the client has a mixed-port setting, change it there. For manual changes, edit the persistent override or currently active local config. Editing a temporary runtime config directly may only work until the next launch or subscription update.
  2. Note the current values. Record the mixed port, control address, and whether the client manages the system proxy. For a proxy port conflict, change only mixed-port; for a control port conflict, change only the port portion of external-controller.
  3. Edit the existing key at the same level. The snippet below shows top-level fields; it is not a complete config. Edit the existing entries rather than adding duplicate keys at the end of the file. Don’t indent these fields under dns, tun, or proxies.
mixed-port: 17890
external-controller: 127.0.0.1:19090

This example binds the control interface to the local loopback address. Keep 127.0.0.1 if you use the management panel locally; don’t change it to 0.0.0.0 to fix a port conflict. Leave the existing secret unchanged. If you entered http://127.0.0.1:9090 manually in the panel, update the port in the API address to 19090.

After saving, restart the core from the client. If there’s no separate restart option, quit the client completely and launch it again. Check the logs for bind errors, then look up the PID on the new port and confirm that the listener is the current core. If the logs still show an attempt to bind 7890, revisit the config source and confirm that the active config and overrides took effect; don’t keep switching ports.

Update system proxy and app ports

Wait until 17890 is listening before switching the system proxy. If the client manages it, turn the client’s “System Proxy” option off and back on, then verify the port in your OS settings. If the client has already set up the proxy or PAC, don’t override it manually. Update the address only if you configured the proxy yourself.

  • Windows 11: Open Settings → Network & internet → Proxy. For a manual setup, edit the proxy server under “Manual proxy setup,” enter 127.0.0.1 as the address and 17890 as the port, then save and verify.
  • macOS: Open System Settings → Network → select your network service → Details → Proxies. If you manually enabled “Web proxy (HTTP)” and “Secure web proxy (HTTPS),” check the proxy server and port for each. If you enabled a SOCKS proxy, check that entry instead.
  • Apps with separate settings: If Firefox uses a manual proxy, check the port under Settings → General → Network Settings → Settings. For terminals, developer tools, or containers using their own HTTP_PROXY, HTTPS_PROXY, or ALL_PROXY, update the variables in use and reopen the relevant session or restart the process.

If an app uses PAC, check that the PAC file no longer returns the old port. Traffic routed only through TUN doesn’t depend on the browser’s mixed-port setting. But if system proxy is also enabled, or an app explicitly uses 127.0.0.1:7890, update that explicit proxy route as well. When troubleshooting a port conflict, leave the existing TUN settings alone to avoid changing both traffic paths at once.

Test the new port: listener, proxy, and system routing

  1. Check the listener. Use the commands above to check 17890 and verify the process name and local address. If the old port belongs to another app that needs to keep running, its continued use won’t affect the new port.
  2. Test the proxy directly. Connect to 17890 as an HTTP proxy and visit an HTTPS test site. This checks the new port on its own, without relying on the system proxy settings.
  3. Test the system proxy. Open a browser that uses the system proxy and visit the same address. Check the client’s connection log for the target domain and matched rule. If the direct proxy test works but the browser doesn’t, check the system proxy address, PAC, or browser-specific settings first—not the port.
curl --noproxy "" -v --proxy http://127.0.0.1:17890 --connect-timeout 5 --max-time 15 https://example.com/

On Windows, use curl.exe instead of curl to avoid it being interpreted as an alias in older versions of PowerShell. If you get Connection refused for 127.0.0.1:17890, first check whether the core is listening on that address. If a CONNECT tunnel is established but you then see a TLS error or timeout, use the logs to investigate certificates or the outbound connection. A successful request only confirms that this request went through the local proxy. Check whether the matched policy is DIRECT or a proxy group to determine whether it used a node.

Windows: No listener found, but the bind still fails

If the error says “An attempt was made to access a socket in a way forbidden by its access permissions” rather than “Address already in use,” and no process is listening, check the TCP excluded port ranges from an administrator terminal:

netsh interface ipv4 show excludedportrange protocol=tcp
netsh interface ipv6 show excludedportrange protocol=tcp

Check the start and end ports for the protocol used by the actual listening address. If your candidate port falls within an excluded range, choose one outside it, then verify in this order: check the listener → update the config → restart → sync the system proxy. Don’t delete system-reserved ranges just to free up a proxy port.

Download Clash