How to find what’s using a port on Mac
Updated 2026-09-28
Direct answer
On macOS, run `lsof -iTCP:<port> -sTCP:LISTEN` (example: `lsof -iTCP:3000 -sTCP:LISTEN`). The COMMAND and PID columns show what is listening. For a full local picture, PortSnap lists every listening TCP port with process name, PID, command, and working directory in the menu bar — including Docker published ports when Docker is running.
Using lsof (built into macOS)
Show the process listening on a specific port:
lsof -nP -iTCP:3000 -sTCP:LISTEN Useful columns:
COMMAND— process name (node, python, …)PID— process id forkillNAME— address and port
List many localhost listeners (noisy but useful):
lsof -nP -iTCP -sTCP:LISTEN | grep -E ':(3000|5173|8080)\\b' Using PortSnap (port manager for Mac)
PortSnap is a menu bar localhost port manager for Mac (also Windows and Linux). It shows every listening TCP port with process name, PID, command, and working directory — so you see which repo owns the socket, not only the binary name.
- Download PortSnap and open it (⌘⇧P).
- Scan or filter to the port you care about.
- Kill with confirm when you need the port back.
Docker published ports appear when the daemon is available. Full list: PortSnap features.
After you find the process
Free the port with kill <PID>, or follow
free port 3000 on Mac. If Node threw EADDRINUSE, see
fix EADDRINUSE in Node.
FAQ
- What is the best Terminal command to see a port on Mac?
- lsof -iTCP:PORT -sTCP:LISTEN is the usual choice for listeners. Add -n -P to skip DNS and show numeric ports.
- Why doesn’t Activity Monitor show the port?
- Activity Monitor focuses on processes and CPU/memory, not TCP listen bindings. Use lsof, nettop, or a port manager like PortSnap to map ports to processes.
- Can I see Docker ports on Mac the same way?
- Host-published Docker ports appear in lsof as the Docker proxy or similar. PortSnap labels Docker published ports next to local processes when the daemon is available.