Symptom
Starting a development server or container reports EADDRINUSE, address already in use or port is already allocated, and the service does not come up, even though you have not started anything else.
Possible causes (most common first)
- A process from the previous run did not exit cleanly and still holds the port in the background. Common after a terminal window was closed outright or a remote session dropped.
- Port 5000 or 7000 is used by AirPlay in macOS. In Apple's port list, both TCP ports are listed under AirPlay.
- A Docker container or another project maps the same port.
- The port is held by a system service or by the platform's remote-access or management components.
Troubleshooting steps (easiest first)
Find out who is listening
Run
lsof -nP -iTCP:5000 -sTCP:LISTENin Terminal (replace 5000 with your port). The output includes the process name and process ID. If it is your own node, python, java or similar, it is a leftover process. If it is a Docker-related process, usedocker psto see which container maps the port.Your own leftover process: end it normally
Once you are sure you started the process, end it with
killfollowed by the process ID, then start the service again. If you usually run services inside tmux sessions, runtmux lsfirst to see whether an old session is still running the same thing.5000 and 7000: changing port is the easiest fix
Both ports belong to AirPlay in Apple's port list. Frameworks such as Flask default to 5000, so collisions are common on a Mac. Giving your own service a different port is the most reliable fix, for example
flask run --port 5001. System Settings has a switch for AirPlay Receiver that you can turn off to free the port, but its location changes between macOS versions and Apple notes the option may be unavailable on a managed Mac, so we do not recommend relying on it.Do not end processes you do not recognise
A rented machine runs background programs that handle remote connection and device management. If
lsofshows a process name you do not recognise, or one not owned by your account, do not end it; you may cut your own remote connection. Move your service to another port and send the process name to support to confirm.Make the port configurable
For long-running services, do not hard-code the port. Set it through an environment variable or a config file so that moving machines means changing one place. For local debugging, binding to
127.0.0.1is enough. Exposing a port to the outside requires changing network configuration, which is not something you may do on your own.
When to contact support directly
If the port is held by a process you do not recognise, or your own process is relaunched the moment you end it, contact support on Contact support. Include your machine ID, the port number and the full lsof output line. If you need a port on the machine to be reachable from the public internet, likewise ask support first whether it is possible. Do not set up port mapping or tunnelling tools yourself.
Related
- Remote Mac mini for heavy Claude Code use: an always-on workstation, not account insurance
- How can I test my site or app from a US network? Rent a real Mac in the United States
- Docker Desktop stuck on Starting and won't start on a remote Mac
- How to keep long tasks running on a remote Mac mini after you disconnect
- Does a long Claude Code task stop when my remote connection drops?
Pricing and availability: see the plans page · Help center (中文) · Refund policy (中文) · Telegram Contact support