Port 5000 or 7000 in Use on a Mac? It's AirPlay Receiver
Port 5000 in use on your Mac? It's ControlCenter running AirPlay Receiver. Confirm it with lsof, turn it off in System Settings, or run Flask on 5001.
Short posts for Mac developers about finding and freeing ports, tested on macOS 27.
Port 5000 in use on your Mac? It's ControlCenter running AirPlay Receiver. Confirm it with lsof, turn it off in System Settings, or run Flask on 5001.
On macOS 27, netstat -an can list no TCP or UDP sockets at all. Why that happens, and the lsof and nettop commands that still show every listening port.
An lsof cheat sheet for Mac: list listening ports, find the process on a port, get its PID, folder and command line. Every command tested on macOS 27.2.
Kill the process on a port on a Mac with lsof and kill: SIGTERM first, kill -9 only when needed, and what to do when launchd, pm2 or Docker restarts it.
What is rapportd, why ControlCenter holds ports 5000 and 7000, and what mDNSResponder does: each Apple process listening on your Mac, its port and its switch.