“Port 3000 is already in use” on Mac
22 Nov 2026 · Yash Rawat
You run npm run dev and instead of your app you get one of these:
Error: listen EADDRINUSE: address already in use :::3000
⚠ Port 3000 is in use, trying 3001 instead.
OSError: [Errno 48] Address already in useSomething on your Mac is already listening on that port. Usually it's your own dev server from earlier, still running in a terminal tab you forgot about, or left behind when an editor crashed. Here's how to find it and get the port back in under a minute.
1Find what’s using the port
macOS ships with lsof (“list open files”), which also lists network sockets. Ask it which process is listening on port 3000:
lsof -nP -iTCP:3000 -sTCP:LISTENYou'll get something like this:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
node 42627 yash 23u IPv6 0x9c1… 0t0 TCP *:3000 (LISTEN)COMMAND is the program (here, Node) and PID is its process ID, which is what you need to stop it. The flags matter: -n and -P skip slow name lookups, and -sTCP:LISTEN shows only the server that owns the port, not every browser tab connected to it.
If nothing comes back but the error persists, the process may belong to another user or to the system. Run the same command with sudo in front.
2Stop it
Use the PID from the output:
kill 42627
# Still there after a few seconds? Force it:
kill -9 42627Plain kill asks the process to shut down cleanly, so it can close files and connections. kill -9 ends it immediately with no clean-up. Reach for it only when the polite version doesn't work, and never on something you can't restart.
Or find and stop it in one go:
kill $(lsof -t -iTCP:3000 -sTCP:LISTEN)You'll see versions of this online without -sTCP:LISTEN. Leave it in: without it, lsof -t -i:3000 also returns any app connected to port 3000, which is often your browser, and you'll kill that too.
3Or just use another port
If the thing on 3000 is something you want to keep running, start your new server somewhere else. Vite already does this on its own and moves to the next free port.
# Next.js
npx next dev -p 3001
# Create React App, Express and most Node servers
PORT=3001 npm start
# Python
python3 -m http.server 8001
flask run --port 50014Why it keeps happening
- A forgotten terminal tab. The server you started an hour ago is still running. Stop dev servers with
Ctrl+Crather than closing the window. - An editor terminal. Closing VS Code or Cursor doesn't always stop what you ran in its built-in terminal.
- A crash. When a parent process dies, its child server can be left running on its own.
- Docker. A container that publishes
-p 3000:3000holds the port on your Mac until you stop the container. - macOS itself, on port 5000 or 7000. That's AirPlay Receiver, and killing it won't help. See what’s using port 5000 on Mac.
5Why I built an app for this
I hit this several times a week, juggling a Next.js site, a Python API and a database. Typing the lsof line, copying a PID and killing it got old, so I built Portable: a small menu bar app that shows every port in use, what's running on it and which project folder it came from. Click ✕ and the port is free. If the process ignores you, the button turns into Force Kill.
It's free to download, signed and notarized by Apple, and never connects to the internet.
The short version
Run lsof -nP -iTCP:3000 -sTCP:LISTEN to find the PID, then kill <PID>. Use kill -9 only if it won't quit. Or skip the terminal and click ✕ in Portable.