Port 3000 Already in Use on Mac? Find the Project Behind It
Find which project is using port 3000 on your Mac, decide whether to keep it running, and get your app preview working again — without killing your browser.

You're working on two projects. Yesterday your coding assistant started the landing page. Today you ask it to start the dashboard, and instead of a preview you get this:
Error: listen EADDRINUSE: address already in use :::3000
Or there's no error at all. You open localhost:3000 and see the landing page instead of the dashboard.
In this guide:
- A request you can paste into your coding assistant. It checks the port and touches nothing.
- A simple choice: keep the server, stop it, or move to another port.
- What to do if the server comes back after you stop it.
- The exact Terminal commands, folded away for when you or your agent need them.
What does “port already in use” mean?
A port is like a door number on your Mac. A web server stands behind one door and waits for visitors. Only one server can wait behind the same door at the same address, so when a second one tries, Node.js refuses with EADDRINUSE, short for “address already in use”.
The error tells you the door is taken. It doesn't tell you by whom, and the server holding the door is often something you still need.
Which of your projects is already running?
The fastest way is to ask your coding assistant to look. It finds the program on the port, tells you which project folder it runs from, and changes nothing.
Find out what is listening on TCP port 3000 on this Mac. For each process, show its PID, the full command and the folder it runs from. Tell me which of my projects it most likely is and what you're not sure about. Hide anything that looks like a key, token or password. Only look: don't stop, restart or change anything. Wait for my decision.
The last two sentences matter. Without them, many assistants “helpfully” kill the process right away. Read what it found before you approve anything.
Here is what the check does, in plain words:
- Find who is behind the door. The program waiting on port 3000 and its process number, the PID.
- See what that program is. Often it only says
next-server, which doesn't tell five Next.js projects apart. - Look at the folder it runs from. That folder is your project, for example
landing. Now you know who holds the port.
The same check in Terminalfor you or your agent
1. Find the listener.
lsof -nP -iTCP:3000 -sTCP:LISTEN
COMMAND PID USER FD TYPE ... NAME node 990 you 13u IPv6 ... TCP *:3000 (LISTEN)
-sTCP:LISTEN keeps only the server and leaves out everything that merely talks to it, such as your browser tab.
2. See what the process is. Replace 990 with your PID. Keep the PPID (parent process ID) in mind: it shows who started the server.
ps -ww -p 990 -o pid,ppid,command
3. See which folder it runs from. The last column is the project folder.
lsof -a -p 990 -d cwd
Two things you might see in step 1:
- Two lines for the same port. The same PID twice is one server on IPv4 and IPv6, which is normal. Two different PIDs are two servers: macOS lets one listen on
127.0.0.1:3000and another on*:3000at the same time, with no error. Check both. - Docker, OrbStack or
sshin the COMMAND column (lsofcuts names to 9 characters, so Docker may show ascom.docke). A container or an SSH tunnel holds the port. Stop that container (find it withdocker ps), not Docker itself, or close the tunnel in the terminal that opened it.
Do you still need that project?
| What you found | What to do |
|---|---|
| The project you're trying to start is already running | Just open it. No need to start it twice. |
| A different project you still need | Keep it. Start the new one on another port, like 3001. |
| A project you're done with | Stop it the normal way (next section). |
| Something you don't recognize | Leave it until you know what it is. |
Leave the server on port 3000 running. Check that port 3001 is free, then start this project on 3001 with its usual start script. If 3001 is taken, use the next free port. Don't stop anything. Show me the exact address from the startup output.
Start on another port yourselffor you or your agent
For Next.js, run this from the new project's folder. The extra -- passes the flag through npm to Next.js. Vite takes --port too; other tools differ, so check the project's start script.
npm run dev -- --port 3001
How do you stop it without breaking anything?
Stop it where it was started. If its Terminal window is still open, click it and press Control-C. If a Run task in your editor (VS Code or Cursor), a process manager like pm2 (a tool that restarts servers) or your assistant started it, stop it there.
If that window is gone, stop that one process and nothing else. Your assistant can do it for you, carefully:
Stop only the server that runs from the [folder you found] folder and listens on port 3000. Right before stopping it, check that it's still the same process. Use a normal stop, not a force kill. Then confirm that port 3000 is free and tell me if anything starts it again.
Prefer a window to commands? Open Activity Monitor, choose View → All Processes, select the process with your PID, click the ✕ button in the toolbar, then choose Quit, not Force Quit.
Stop it in Terminalfor you or your agent
Check the PID again first, because numbers get reused. Then ask the server to shut down (replace 990 with your PID) and run the step 1 check again to confirm the port is free:
kill -TERM 990 lsof -nP -iTCP:3000 -sTCP:LISTEN
Use kill -KILL only for a process you've identified that won't stop, since it skips any cleanup. The popular lsof -ti :3000 | xargs kill lists clients too; the safe form is lsof -ti tcp:3000 -sTCP:LISTEN, and even then, look before you kill. npx kill-port 3000 targets only the listener but force-kills by default.
Why does localhost:3000 show the wrong project?
Because the new server may not be on 3000 at all. Next.js (when you didn't set a port) and Vite (unless its strictPort option is on) don't fail: they move to the next free port and say so in one line of the startup log that's easy to miss. Next.js 16 even names the process holding 3000: “Port 3000 is in use by process 990, using available port 3001 instead”. Your dashboard is running happily on localhost:3001 while the browser still shows yesterday's landing page on 3000.
Read the address in the startup output instead of typing 3000 from habit. If the address is right and you still see the old page, reload without the cache (Shift-Command-R in Chrome or Firefox; in Safari, open the address in a private window).
Nothing shows up, but the error stays?
- Check right after the error. A server that crashes and restarts can be gone for a second.
- It may belong to another user on the Mac. The same check with admin rights shows it. Don't use admin rights to stop something you can't identify.
- The port is 5000 or 7000. If the program is called
ControlCe, that's macOS Control Center: the AirPlay Receiver listens there. Turn it off in System Settings → General → AirDrop & Handoff → AirPlay Receiver, or use another port.
The admin-rights checkfor you or your agent
Read-only, it only looks:
sudo lsof -nP -iTCP:3000 -sTCP:LISTEN
You stopped it, and it came back?
Then something keeps restarting it: a process manager like pm2 (a tool that restarts servers), a file watcher, a macOS launch agent (a background job that starts at login), a Run task in your editor, your coding assistant, or a “keep alive” option in a tool like AI Garage. Find what restarts it, turn the restart off there, then stop the server once. Killing it harder won't help.
Follow the parent chainfor you or your agent
Take the PPID from step 2 and look at the parent. Repeat with each new parent until you reach something you recognize. On our test Mac the chain went next-server → next dev → npm run dev, which pointed straight at the terminal tab that started it.
ps -ww -p <PPID> -o pid,ppid,command
If you run several projects every day
For a one-off conflict, the steps above are enough. If your coding assistant starts servers for you every day, it gets hard to remember which project sits on which port. After a long agent session, run through what to check when your AI agent left dev servers running.
Sources
Checked on November 16, 2026. Commands were run on macOS 15.7.4 with Node.js 24; port behaviour checked for Next.js 16.2 and Vite 7.3.
lsofmanual: the-i,-sTCP:LISTEN,-aand-d cwdoptions (lsof-org/lsof).- Node.js: common system errors,
EADDRINUSE(nodejs.org). - Next.js CLI: changing the port with
-pand passing flags throughnpm run(nextjs.org). - npm: how
--passes arguments to a script (docs.npmjs.com). - Vite:
server.portandserver.strictPort(vite.dev). - Apple: quitting a process in Activity Monitor (support.apple.com).
Next up:AI Agent Left Dev Servers Running? Find Them on Your Mac
Explore more:LocalhostMCP, simplySecurity
More on your setup
swipe sideways

Essentials
Five guides to read first
1
2
3