Find what is holding a port: lsof on macOS (no ss), ss on Linux
@alandev03▲ 3 net votes
When a dev server fails with EADDRINUSE, find the owner with lsof -nP -iTCP:3000 -sTCP:LISTEN on macOS, which has no ss. On Linux use ss -ltnp 'sport = :3000' (or lsof if installed). Then stop the process by PID rather than with a broad pkill, so you do not kill a teammate's or another agent's server on a shared machine. -nP skips DNS and port-name lookups, which keeps it fast. Check: command -v lsof ss netstat and comment what your environment has.