How to find what’s using a port on your Mac
Error: listen EADDRINUSE: address already in use :::3000 means something is already listening there. Here’s how to see exactly what it is, where it came from, and whether it’s safe to stop.
Updated
The quick answer
Open Terminal and ask lsof which process is listening on the port:
lsof -nP -iTCP:3000 -sTCP:LISTEN
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
node 48211 you 23u IPv6 0x... 0t0 TCP *:3000 (LISTEN)
-iTCP:3000limits it to TCP port 3000. Change the number for any other port.-sTCP:LISTENshows only the server, not every connection to it.-nand-Pskip DNS and port-name lookups, so it answers instantly and shows numbers.
To list every listening port on your Mac:
lsof -nP -iTCP -sTCP:LISTEN
“node” isn’t an answer: find which project it is
lsof tells you the command is node and the PID is 48211, but you probably have five Node projects. Two more commands get you the rest:
# The full command line: which script or framework
ps -o pid,ppid,etime,command -p 48211
# The working directory: which project folder
lsof -a -p 48211 -d cwd -Fn | tail -1
etime is how long it’s been running, and ppid is the parent process. Follow the parent (ps -o ppid,command -p <ppid>) and you’ll usually reach a shell, then the terminal, editor or AI agent that started it. If the parent is 1 (launchd), its terminal is gone: it’s an orphan, and nobody is going to stop it for you.
Check whether it’s exposed to your network
Look at the address in the NAME column:
| Shows | Who can connect |
|---|---|
127.0.0.1:3000 or [::1]:3000 | Only this Mac |
*:3000 or 0.0.0.0:3000 | Anyone on the same network |
Many dev servers bind to every interface by default, or when you pass --host. On shared Wi-Fi that means other people can load your app, its API, or an admin panel with no password. Bind to 127.0.0.1 unless you’re deliberately testing on your phone.
Then: stop it, or pick another port
If it’s a server you forgot about, stop it gracefully with its PID:
kill 48211
The full walkthrough, including stubborn processes and Docker, is in how to kill a process on a port.
If it’s something you need, start your new server on another port instead, for example PORT=3001 npm run dev or vite --port 5174.
Doing this without Terminal
Stat Space keeps this list in your menu bar. Every listening port shows its framework, project folder, the launcher behind it (Terminal, VS Code, Cursor, Claude Code, Docker, launchd) and its uptime. Anything bound to 0.0.0.0 gets a warning. From the row you can open it in the browser, copy the URL, show a QR code for your phone, or stop it.
From the terminal, the same answer is one command:
statspace port 3000
Questions
Why does lsof show nothing, but the port is still in use?
The process may belong to another user or root. Run the same command with sudo. It can also be a Docker container, in which case lsof shows com.docker.backend (or OrbStack/Colima) rather than your app; run docker ps to see the container that published the port.
What does *:3000 versus 127.0.0.1:3000 mean?
127.0.0.1 (or localhost) means only your Mac can reach it. * or 0.0.0.0 means it accepts connections from any network you're on, including café Wi-Fi. Dev servers should usually be bound to localhost.
Is port 5000 or 7000 in use by AirPlay?
Yes, on macOS 12 and later the AirPlay Receiver (ControlCenter) listens on 5000 and 7000. Turn it off in System Settings › General › AirDrop & Handoff › AirPlay Receiver, or use a different port.
Know what your Mac is doing, without adding to it.
Free, no account. Pro is $9.99 once for the first 100 buyers.