WTMemory guide

Port 3000 already in use on Mac: find and kill the process

Updated 13 October 2026

To free port 3000 on a Mac, run lsof -nP -iTCP:3000 -sTCP:LISTEN to see which process is listening on it, then stop that process with kill <PID>. Use kill -9 only if it ignores the normal signal. Usually the culprit is a dev server (Node, Vite, Next.js, Rails, Python) left running from an earlier session.

If you would rather see listening ports in a list than type commands, the free WTMemory menu-bar app shows them with the owning process. More on that at the end; the Terminal method below works on every Mac.

What does "EADDRINUSE: address already in use :::3000" mean?

Only one process can listen on a given TCP port and address at a time. When Node prints Error: listen EADDRINUSE: address already in use :::3000, or Rails says Address already in use - bind(2) for "127.0.0.1" port 3000, the operating system refused the bind because something already holds that port. Your new server is fine. You need to find and stop the old listener, or start on a different port.

How do I find what is using port 3000 on Mac?

macOS ships lsof (list open files), which also lists network sockets:

lsof -nP -iTCP:3000 -sTCP:LISTEN

Typical output:

COMMAND   PID  USER   FD   TYPE  DEVICE SIZE/OFF NODE NAME
node    48213  you    23u  IPv6  0x...       0t0  TCP *:3000 (LISTEN)

The PID column is what you kill. COMMAND is truncated to nine characters, so to see the full command line, including the project path, run ps -p 48213 -o pid,ppid,etime,command.

To list every listening TCP port on the Mac at once:

lsof -nP -iTCP -sTCP:LISTEN

lsof only shows processes you are allowed to inspect. If the port is busy but lsof prints nothing, the listener belongs to another user or root: repeat the command with sudo.

How do I kill the process on port 3000?

kill 48213

Run the lsof command again. No output means the port is free. As a one-liner:

lsof -ti tcp:3000 -sTCP:LISTEN | xargs kill

-t prints only PIDs, which xargs passes to kill. On macOS, BSD xargs does not run the command when there is no input, so this is harmless when the port is already free.

Keep the -sTCP:LISTEN filter. The popular lsof -ti :3000 | xargs kill also matches every client with a connection to port 3000, which usually includes your browser tab on localhost:3000. Without the filter you can quit Chrome or Safari along with the server.

kill vs kill -9: which should you use?

Plain kill sends SIGTERM, a polite request to exit. Node, Vite, Next.js, Rails and most servers catch it, close sockets, flush logs and stop their child processes. kill -9 sends SIGKILL, which the kernel enforces immediately. The process gets no chance to clean up, so:

Send kill, wait two or three seconds, check with lsof, and only then escalate to kill -9.

Why is the server still running after I closed the terminal?

Closing a Terminal window normally hangs up the shell and its jobs, but plenty of setups survive that:

How do I find orphaned dev servers by name?

When you have several stale servers, list them by name with their parent PID and running time:

ps -axo pid,ppid,etime,command | grep -E 'node|vite|next|webpack|rails|python' | grep -v grep

A PPID of 1 means the process was orphaned and adopted by launchd. A large ETIME (days, or hours with no terminal open) is another hint. pgrep -fl vite gives a shorter list. You can stop by pattern with pkill -f "next dev", but check what pgrep -fl "next dev" matches first, because -f matches anywhere in the full command line.

What if Docker is holding the port?

If lsof shows a Docker process (for example com.docker.backend), a container publishes that port. Do not kill the Docker process, which would stop every container. Find the container and stop it:

docker ps --filter "publish=3000"
docker stop <container>

Common development ports on Mac

PortUsual owner
3000Next.js, Create React App, Nuxt, Rails, many Express apps
4200Angular CLI
5000, 7000AirPlay Receiver (ControlCenter), Flask default
5173, 4173Vite dev server, Vite preview
8000Django, python3 -m http.server
8080Tomcat, Spring Boot, assorted proxies
8888Jupyter
5432, 3306, 6379, 27017PostgreSQL, MySQL, Redis, MongoDB
11434Ollama

The same lsof command works for any of them: replace 3000 with the port number.

Why is port 5000 or 7000 in use on macOS?

Since macOS Monterey, AirPlay Receiver listens on ports 5000 and 7000, and lsof shows the owner as ControlCenter. That is why a fresh Flask app fails with "Address already in use" on a Mac with nothing else running. Do not kill ControlCenter; macOS relaunches it. Instead either:

How do I avoid port conflicts next time?

Find what is using a port from the menu bar

WTMemory is a native macOS menu-bar app for macOS 12 and later, on Apple Silicon and Intel. Choose Find What's Using a Port from its menu to see TCP listening endpoints and the process behind each, or open Running Apps to see each developer process with its PID, executable location, memory and CPU. Inspection is free.

Stopping a process is a Pro action, and you review and confirm it first. Stopping a listener stops the whole process, not just one port, and WTMemory does not label processes as abandoned or safe to stop: you decide. Apps you protect with the lock control are never quit. Pro costs $9 USD once for up to three Macs, with a seven-day trial.

Download WTMemory

FAQ

How do I kill whatever is on port 3000 in one command?

Run lsof -ti tcp:3000 -sTCP:LISTEN | xargs kill. The -sTCP:LISTEN filter matters: without it, lsof also returns clients connected to port 3000, such as your browser, and you would kill those too.

Is kill -9 bad?

It is a last resort. SIGKILL ends the process immediately with no chance to flush writes, remove lock files or stop child processes. Try a plain kill first and wait a few seconds.

Why does the process come back after I kill it?

Something is restarting it: Homebrew services via launchd, pm2, nodemon, a file watcher or a Docker container with a restart policy. Stop it through that tool instead, for example brew services stop or docker stop.

Do I need sudo to see what is using a port?

Only for processes owned by another user or root. If lsof shows nothing but the port is still taken, run the same command with sudo.

Why is port 5000 in use on my Mac when I have nothing running?

Since macOS Monterey, AirPlay Receiver listens on ports 5000 and 7000 through the ControlCenter process. Turn off AirPlay Receiver in System Settings, or run your app on another port.

Related guides

Full WTMemory guide and license help