How to kill the process on port 3000 on a Mac
Your dev server will not start because something already holds port 3000. Here is how to find it and stop it from the Terminal.
1. Find what is using the port
This lists the process that is listening on port 3000:
lsof -nP -iTCP:3000 -sTCP:LISTENThe PID column is the process ID. COMMAND tells you what it is, usually node.
2. Stop it
kill 41074Use the PID from step 1 instead of 41074. This sends a polite stop signal (SIGTERM) and gives the process a chance to shut down.
The one-liner
kill $(lsof -ti tcp:3000 -sTCP:LISTEN)lsof -t prints only the PID, so kill gets exactly the listener. If nothing is listening, kill prints a usage error. That is fine.
If it does not stop
kill -9 $(lsof -ti tcp:3000 -sTCP:LISTEN)-9 (SIGKILL) cannot be ignored, but the process gets no chance to clean up. Try the plain kill first.
If it comes back
Some tools restart their child, or the real process is the parent (npm run dev starts node). Stop the whole process group instead. Find the group ID, then signal the group:
ps -o pgid= -p 41074
kill -TERM -- -41070Use the number the first command prints (41070 here). The minus sign in front of it tells kill to signal the whole group.
If it is a Docker container
Docker publishes ports through its own process, so the PID lsof shows is not the thing to stop. List the container instead:
docker ps --filter publish=3000
docker stop my-containersudo only if you know what you are stopping.Or do it in one click
Rungeist sits in your menu bar and lists the dev servers running from your project folders, with the port, the project and how long each has been running. Click the one on port 3000 and stop it. It ends the whole process group, so a child that would respawn goes too, and your shell, editor and AI session are not touched.