Find which process is using a port on Mac

Identify the app holding port 8080 (or any other port).

macOSlsofProcessesDiagnosticsLow risk
Run the command below, replacing 8080 with your port. It prints the process name, PID and user. Stop it with kill <PID> once identified.

01Command

Command
$ lsof -nP -iTCP:8080 -sTCP:LISTEN

02What it does

'Address already in use' errors usually mean another process is listening on the port. lsof lists open files — including network sockets — and -iTCP:8080 -sTCP:LISTEN narrows it to listeners on that port. -n skips DNS lookups and -P shows raw port numbers, making it fast and readable.

03Risk

RiskLow risk
CompatibilitymacOS 10.11 El Capitan – 15 Sequoia
!Warning: Only kill processes you recognize; system services also listen on ports.

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

  • lsof — list open files
    SS64 · technical · 2025-11-16
    Evidence: lsof -iTCP:PORT -sTCP:LISTEN lists processes listening on a TCP port.

Last verified: 2025-11-16 · Category: Developer

06Related solutions