The right answer to "port already in use"
lsof -i tells you which process is using which network ports — including the program name, PID, and user. On macOS this is the go-to tool because netstat doesn't show process info. On Linux, ss -tulnp is roughly equivalent.
The one-liner you'll use forever
When a dev server fails with "EADDRINUSE :::3000", the cycle is:
lsof -i :3000— what's holding the port?- Note the PID.
kill PID(orkill -9 PIDif it ignores the polite request).
Or do it in one shot: lsof -ti :3000 | xargs kill -9. -t outputs just PIDs, suitable for piping into kill.