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
- A watcher restarted it. nodemon, pm2, turbo or a
concurrentlyscript start the server again when it dies. Find the parent withps -o pid,ppid,command -p 48213, then stop that, or press Ctrl-C in the terminal that runs it. For pm2:pm2 stop all. - A container has it. If the COMMAND column shows Docker's or OrbStack's own process instead of node or python, a container published the port. Find it with
docker ps --filter publish=3000and stop it withdocker stop <name>. - lsof shows nothing, but the port is still taken. It belongs to another user or root. Run the same command with
sudoto see it.