The problem
You try to start a Flask app, Django, or any server on port 5000 and get an error:
OSError: [Errno 48] Address already in use
Or in Node.js:
Error: listen EADDRINUSE: address already in use :::5000
What is using port 5000? Apple's AirPlay Receiver.
Confirm the cause
$ ptrm 5000
Port 5000
PID 610
Name ControlCenter
Cmd /System/Library/CoreServices/ControlCenter.app
# Or with lsof:
$ lsof -i :5000
COMMAND PID USER FD TYPE DEVICE NODE NAME
ControlCenter 610 dev 28u IPv4 0x... TCP *:commplex-main (LISTEN)
ControlCenter 610 dev 29u IPv6 0x... TCP *:commplex-main (LISTEN)
If you see ControlCenter, it is AirPlay Receiver. This is a macOS system process -- you cannot simply kill -9 it (it will restart immediately).
Fix 1: Disable AirPlay Receiver (recommended)
macOS Ventura, Sonoma, Sequoia (13+)
- Open System Settings
- Go to General → AirDrop & Handoff
- Turn off AirPlay Receiver
macOS Monterey (12)
- Open System Preferences
- Go to Sharing
- Uncheck AirPlay Receiver
Port 5000 (and 7000) will be freed immediately. No restart required.
Fix 2: Use a different port
If you want to keep AirPlay Receiver enabled, change your app's port:
# Flask
$ flask run --port 5001
# Django
$ python manage.py runserver 5001
# Node.js / Express
$ PORT=5001 node server.js
# Docker
$ docker run -p 5001:5000 my-flask-app
Fix 3: Command line (temporary)
You can kill ControlCenter, but it will restart within seconds:
$ kill $(lsof -ti :5000)
# Port 5000 is free... for about 3 seconds
This is not a permanent fix. Use Fix 1 or Fix 2 instead.
Which ports does AirPlay use?
| Port | Protocol | Service |
|---|---|---|
| 5000 | TCP | AirPlay Receiver (HTTP) |
| 7000 | TCP | AirPlay Receiver (RTSP) |
| 49152+ | UDP | AirPlay audio/video streams |
Affected frameworks
Port 5000 is the default for many popular frameworks. Since macOS Monterey, all of these need a port change or AirPlay disabled:
| Framework | Default Port | Change to |
|---|---|---|
| Flask | 5000 | flask run -p 5001 |
| Django (runserver) | 8000 (safe) | No change needed |
| ASP.NET Core | 5000 | --urls http://localhost:5001 |
| Phoenix (Elixir) | 4000 (safe) | No change needed |
| Streamlit | 8501 (safe) | No change needed |
portrm detects system services
portrm tells you what is on any port, including system services like AirPlay Receiver. No more guessing.