Clash Port 7890 Already in Use: Find the Process and Change the Listening Port

Seeing “address already in use” on startup? Find the process with netstat or lsof, change the mixed or controller port, and update your system proxy settings.

Identify the listening port that triggered the error

Open the client's startup log and look for an error line containing bind or listen. Note the protocol, listening address, and port, then compare them with the active configuration. If you see listen tcp 127.0.0.1:7890: bind: address already in use, the core could not listen on TCP port 7890 at a local address. This is not a subscription update failure or an unreachable remote node, so there’s no need to switch nodes or change routing rules yet.

Choose the field to check based on the port’s purpose
PurposeConfiguration fieldWhat to check
Mixed proxymixed-portAccepts HTTP and SOCKS5 proxy connections on the same port; this article uses 7890 as an example.
Separate proxiesport、socks-portUsed for separate HTTP and SOCKS listeners. Check whether both are enabled and configured to use the same port.
External controllerexternal-controllerController API address; this article uses 127.0.0.1:9090 as an example. Do not enter it as a system proxy.

Use the port shown in the active configuration and logs. Even if the error says 127.0.0.1:7890, check whether an existing process is listening on 0.0.0.0:7890, which also covers the local IPv4 loopback address. If the log says listen udp, check the corresponding UDP socket; an empty TCP query does not mean the port is available. The commands below cover the more common case of a TCP listening conflict.

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

Windows: Find the PID with netstat

Run the commands below in PowerShell. The first filters TCP entries for the specified port. Check only lines where the local address ends in :7890 and the state is LISTENING. A remote address containing 7890, or a TIME_WAIT entry by itself, does not identify a listening process.

netstat -ano -p tcp | findstr ":7890"
Get-Process -Id 4321

In the second command, 4321 is just an example. Replace it with the PID in the last column of the matching line above. You can also check the process name in Task Manager under Details by PID; to distinguish processes with the same name, right-click and choose Open file location. If the core runs as a service, it may keep listening after you close the desktop app. Check its status in the client or system service manager.

macOS: Find the listener with lsof

sudo lsof -nP -iTCP:7890 -sTCP:LISTEN

Check the COMMAND, PID, and NAME columns. In NAME, *:7890 means the process listens on all addresses, not just one specific local address. If the controller port is in conflict, replace 7890 in the command with the port shown in the log.

Linux: Check local TCP listeners with ss

sudo ss -ltnp 'sport = :7890'

Check the local address column and the process name and PID after users:. If you run the command again a few seconds later and see the same process name but a different PID, check whether a service manager is restarting it automatically. If the core runs in a container, investigate in the network namespace where the core runs. If the error occurs while the container runtime publishes a host port, check the host's port mappings.

Change the mixed or external controller port

If you can’t free up 7890, try 7891. First, replace the port in the query command with 7891 and confirm that nothing is listening on it. Then back up the current settings and make the change in the client’s port settings or configuration override. If you use a subscription, edits to the downloaded YAML may be overwritten on the next update. If you run the core separately, edit the configuration file actually loaded by that instance.

mixed-port: 7891

Change the existing top-level mixed-port value. Don’t add another setting with the same name at the end of the file. If you use separate port or socks-port settings, change only the conflicting field; there’s no need to enable a mixed port. Save the change and restart the core, then check the port again to confirm that the expected process is listening.

If the log points to the external controller port, such as 9090, first check that 9091 is free, then change the controller address on its own. If you use the dashboard only on this machine, keep it bound to the loopback address and retain the existing controller access key. A controller port conflict does not require changing the proxy port.

external-controller: 127.0.0.1:9091

After switching the controller to 9091, update the address in any dashboard that connects to the core manually. If the GUI client generates the controller configuration, change the setting in the client and restart it so the dashboard and core stay in sync. Otherwise, proxy connections may work while the dashboard’s node list and connection logs fail to load.

Update system and app proxy settings

  1. System proxy managed by the client: First confirm that the core is listening on the new port. Then turn the client’s System Proxy toggle off and back on, and check that the system proxy port changed from 7890 to 7891.
  2. Manually configured system proxy: On Windows 11, go to Settings → Network & internet → Proxy → Manual proxy setup. On macOS, go to System Settings → Network → select your current connection → Details → Proxies. Keep the local HTTP proxy address as 127.0.0.1 and change the port to 7891. Update only entries that pointed to the old mixed port.
  3. Apps with their own proxy settings: Browser extensions, terminal environment variables, and developer tools with manually configured addresses won’t update with the system proxy. Check HTTP_PROXY, HTTPS_PROXY, ALL_PROXY, and their lowercase equivalents. If the old address comes from a startup script, open a new terminal after editing it and test again.
  4. Devices on your local network: If a phone or TV already uses a proxy shared from your computer, keep the computer’s local network address, change only the proxy port, and check the relevant firewall rules. On the device, 127.0.0.1 refers to the device itself, not your computer. If the proxy is for this computer only, there’s no need to enable LAN sharing just to change the port.

Verify the new port and troubleshoot remaining issues

First confirm that the expected core is listening on 7891, then send a request through an explicitly specified HTTP proxy. This keeps the system proxy and browser extensions out of the test. In Windows PowerShell, use curl.exe; on macOS and Linux, you can use curl. If NO_PROXY or no_proxy is set, make sure the test domain isn’t excluded.

curl -v -I --connect-timeout 5 --max-time 15 --proxy http://127.0.0.1:7891 https://example.com/
  • Can’t connect to 7891: Use a listener query to check the port and address. If the core is still listening on 7890, check the client overrides, the configuration in use, and whether you restarted the correct instance.
  • Connected to 7891, but got no response from the destination: The local TCP connection works. Check the client log for proxy authentication, rule matching, DNS, or outbound connection issues at the same time. There’s no need to keep changing ports at random.
  • The command succeeds, but one app still can’t connect: Check whether that app’s proxy address, extension, or environment variable still points to 7890. Don’t assume 7891 works just because a webpage opens in TUN mode; TUN handles traffic without the app connecting to this HTTP proxy port.
  • Need to revert? First confirm that the original port is free, then restore the backup and the corresponding system and app proxy settings. If the core won’t start yet, disable any manually configured system proxy that points to the unavailable address to avoid disrupting connections that don’t use a proxy.
Download Clash