← Guides

Kill the process on port 3000 on a Mac

Your dev server fails with EADDRINUSE or picks port 3001 because something already has 3000. Find it with lsof, then stop it with kill.

Find what's on the port

lsof -nP -iTCP:3000 -sTCP:LISTEN
COMMAND   PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
node    48213 you    23u  IPv6 0x1f…      0t0  TCP *:3000 (LISTEN)

-iTCP:3000 picks the port, -sTCP:LISTEN shows only the server and not the browser tabs connected to it, and -nP skips name lookups so it answers instantly. The number under PID is what you stop.

Stop it

kill 48213

kill sends SIGTERM, which lets the server close its connections and exit cleanly. If it's still listed a few seconds later, force it with kill -9 48213.

Or find and stop it in one line. -t makes lsof print only the PID:

kill $(lsof -t -iTCP:3000 -sTCP:LISTEN)

When it comes straight back