Port 5000 in Use on Mac: AirPlay, Flask, and How to Free It

Port 5000 is used by macOS AirPlay Receiver and Flask's dev server. Here's why they collide, whether it's safe to close, and how to free it.

Port 5000 is the classic macOS conflict. You start a Flask app, it fails because the port is already taken, and you swear you didn’t start anything. On modern macOS, you didn’t: the system itself is using it.

What typically listens on port 5000

  • AirPlay Receiver (macOS Monterey and later): Apple’s AirPlay Receiver, part of the ControlCenter process, binds port 5000 (and 7000) so your Mac can receive AirPlay streams. This is on by default.
  • Flask: Flask’s development server defaults to 5000, which is exactly why the conflict is so common.
  • Older Rails and other dev tools: A handful of frameworks also default here.

So a “port 5000 in use” error on a Mac is usually AirPlay, not a leftover server.

Is it safe to kill?

It depends on what owns it. If lsof shows ControlCenter, that’s AirPlay Receiver, a system process you shouldn’t force-quit. Turn the feature off instead:

System Settings > General > AirDrop & Handoff > AirPlay Receiver (off).

That frees port 5000 system-wide. If lsof shows your own python or Flask process, killing it is perfectly safe.

Is it suspicious?

No. On macOS, 5000 in use is almost always AirPlay Receiver doing its job. The only real problem is the collision with dev servers. Confirm the owner before doing anything; the command below shows it.

How to find and free port 5000 on macOS

lsof -i :5000

If it’s your own dev server:

kill -9 $(lsof -ti :5000)

If it’s AirPlay Receiver, disable it in settings instead of killing the process, or just run Flask on another port:

flask run --port 5001

For a deeper walkthrough of the dev-server case, see Port 5000 in use on Mac. Portie makes the AirPlay-versus-your-server question instant: it shows port 5000 with the exact app that owns it, so you know immediately whether to disable AirPlay or kill a stray Flask process.

Common questions

Why is port 5000 in use on my Mac when nothing is running?

On macOS Monterey and later, AirPlay Receiver (part of the ControlCenter process) listens on port 5000 by default. That's why Flask and other dev servers that default to 5000 suddenly fail to start.

Is it safe to kill whatever is on port 5000?

If it's AirPlay Receiver, don't force-kill ControlCenter. Turn AirPlay Receiver off in System Settings > General > AirDrop & Handoff instead. If it's your own Flask server, killing it is safe.

How do I free port 5000 for Flask?

Either disable AirPlay Receiver in settings, or run your dev server on another port such as 5001. Disabling AirPlay frees 5000 system-wide.

Try Portie Free

See every open port on your Mac, which app owns it, and kill processes from the list.

Download Free