What’s using port 5000 on my Mac?
22 Nov 2026 · Yash Rawat
You start a Flask app, or anything else that defaults to port 5000, and macOS says the address is already in use. Or the server starts, but localhost:5000 answers with 403 Forbidden and an empty page. You didn't start anything on 5000. So what did?
It's AirPlay. Since macOS Monterey, your Mac can act as an AirPlay receiver, so you can cast to it from an iPhone, and that receiver listens on ports 5000 and 7000.
1Check that it’s AirPlay
lsof -nP -iTCP:5000 -sTCP:LISTENCOMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
ControlCe 921 yash 9u IPv4 0x51e… 0t0 TCP *:5000 (LISTEN)
ControlCe 921 yash 10u IPv6 0x7a2… 0t0 TCP *:5000 (LISTEN)ControlCe is Control Center (lsof cuts names to 9 characters), the macOS process that runs AirPlay Receiver. If you're getting a 403, you can also check who's answering:
curl -sI http://localhost:5000 | grep -i serverA Server: AirTunes/… header means your request never reached your app. It hit AirPlay.
2Don’t kill it
Your first instinct might be kill 921. It won't help: Control Center also runs your menu bar's Wi-Fi, sound and battery controls, and macOS relaunches it straight away, AirPlay and all.
3Turn off AirPlay Receiver
- Open System Settings.
- Go to General → AirDrop & Handoff.
- Turn off AirPlay Receiver.
Ports 5000 and 7000 are free immediately, no restart needed. You only lose the ability to cast to this Mac. You can still AirPlay from it to a TV or speaker.
4Or move your app instead
If you use AirPlay to your Mac, leave it on and run your server on another port:
# Flask
flask run --port 5001
# or in code
app.run(port=5001)5See it without the terminal
This one caught me out more than once, so Portable, my menu bar app for localhost ports, calls it out. Ports 5000 and 7000 show up as AirPlay Receiver in a separate System section, and clicking the row shows exactly where to turn it off. Your own servers stay at the top, each with its port and project folder and a one-click stop button.
Hitting “address already in use” on another port? See how to find and kill the process on any port.
The short version
Port 5000 (and 7000) on macOS is AirPlay Receiver. Turn it off in System Settings → General → AirDrop & Handoff, or run your app on 5001.