Dhiru · dev watch
How to see what's running on a port on Mac (and stop it)
Open Terminal and run this, with your port in place of 3000:
lsof -nP -iTCP:3000 -sTCP:LISTEN
You'll see the command name and a PID (process ID). Stop it with:
kill <PID>
If it's still there a few seconds later, force it with kill -9 <PID>. To stop whatever is on a port in one go:
kill $(lsof -t -iTCP:3000 -sTCP:LISTEN)
See every server you left running
Leave the port out to list everything that's listening:
lsof -nP -iTCP -sTCP:LISTEN
Ports used by common tools: 3000, 3001, 3306, 4000, 4200, 4321, 5000, 5173, 5432, 5555, 6006, 6379, 7000, 8000, 8080, 8081, 8787, 8888, 9000, 9229, 27017