Skip to content
ONECLICKTOOLINDEPENDENT STUDIO
Developer on Mac

Port 3000 already in use on Mac? Find what is using it and stop it

Fix EADDRINUSE on port 3000 (or 5173, 8080) on a Mac: one lsof command shows the process and its project folder, then stop it safely. Tested on macOS 26.

Tu Nguyen, Mac app developer at OneClickTool · Published Oct 19, 2026 · 3 min read
Tested onMacBook Pro 14" (M1 Pro, 16 GB)
macOS26.3 Tahoe
Also checkedNode.js 22.19 and Next.js 14.2 dev servers, Python 3 http.server
Last verifiedOct 19, 2026
Applies tomacOS 12 Monterey – 26 Tahoe
Short answer
  • Port 3000 is in use because another process, usually a dev server you started earlier, is still listening on it.
  • Run lsof -nP -iTCP:3000 -sTCP:LISTEN in Terminal to see the process name and its PID.
  • Stop it with kill followed by the PID; use kill -9 only if the process ignores a normal kill.
  • On macOS 12 or later, port 5000 and 7000 errors are usually AirPlay Receiver, which you turn off in System Settings.

What the error means#

You run npm run dev, next dev or node server.js and get:

Error: listen EADDRINUSE: address already in use :::3000

Only one process can listen on a port at a time. Something already holds port 3000, so your new server cannot. Nine times out of ten that something is your own dev server from earlier: a terminal tab you closed, a VS Code window you forgot, or a background command an AI coding agent started. Vite shows the same problem on 5173, and many backends on 8080 or 8000.

We reproduced it on our test Mac by starting a small Node server on 3000 and then starting a second one. The second crashed with exactly the error above.

Step 1: find what is using port 3000#

Open Terminal and run:

lsof -nP -iTCP:3000 -sTCP:LISTEN

You get one line per listener:

COMMAND   PID    USER   FD   TYPE  ...  NAME
node    53977 tucarmd   12u  IPv6  ...  TCP *:3000 (LISTEN)

COMMAND is the program and PID is its process ID, the number you will need next.

A detail that confuses people: if you leave out -nP and run plain lsof -i :3000, the last column says *:hbci instead of *:3000. That is not a different port. lsof swaps numbers for names from /etc/services, where 3000 happens to be listed as "hbci". The -P flag turns that off.

Step 2: check which project it belongs to#

Before you stop it, make sure it is not a server you still need. Two quick checks with the PID from Step 1:

ps -o pid,etime,rss,command -p 53977
lsof -a -p 53977 -d cwd -Fn | tail -1

The first shows how long it has been running (etime), how much memory it holds (rss, in KB) and the full command. The second prints the folder the process was started in, which tells you which project it is. On our Mac it pointed straight at the test folder we had started it from.

Step 3: stop it#

kill 53977

kill sends a normal stop signal (SIGTERM), the same as pressing Ctrl C in the terminal that started it. Run the lsof command from Step 1 again: no output means port 3000 is free. On our test Mac the server stopped within a second, and a new server started on 3000 without errors.

Only if the process ignores that, force it:

kill -9 53977

-9 cannot be ignored, but it also gives the server no chance to clean up, so use it second, not first.

Shortcut: once you know what is there, kill $(lsof -t -iTCP:3000 -sTCP:LISTEN) finds and stops it in one line. The -t flag makes lsof print only PIDs.

Port 5000 or 7000? That is AirPlay#

If the busy port is 5000 or 7000, look at the COMMAND column. On our Mac it said ControlCe, which is ControlCenter. Since macOS 12 Monterey, the AirPlay Receiver listens on both ports, which collides with Flask's default port 5000.

Do not kill ControlCenter; it restarts anyway. Either run your app on another port (flask run --port 5001) or turn the receiver off in System Settings › General › AirDrop & Handoff › AirPlay Receiver (the panel is called AirDrop & Continuity on newer macOS; on Monterey it is under System Preferences › Sharing).

Stop it from happening again#

  • Stop servers with Ctrl C before closing the terminal tab. Closing the window does not always stop a process started with nohup, & or by an editor.
  • Let the tool pick a free port. Vite moves to the next port by itself unless strictPort is set; Next.js accepts -p 3001.
  • Check every listening dev server at once with the command in our guide to finding forgotten localhost servers. It lists each one with its port, uptime, memory and project folder. Xcode users chasing space rather than ports should read Xcode taking up too much space.

If you would rather not keep Terminal commands around, RAM Rescue (our free, open-source Mac app) has a Localhost tab that lists every open port with a health dot, memory and uptime, and a Stop button next to each. It also lets you start and stop your projects with a live log. See the RAM Rescue page.

RAM Rescue (made by us)
RAM Rescue shows the apps using your Mac's memory as big cards with a Quit button, finds dev processes left behind by closed terminals, and cleans caches apps rebuild by themselves. Pro watches memory from the menu bar: it warns you before your Mac slows down and catches apps that leak memory..
See RAM Rescue

FAQ

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

Run kill $(lsof -t -iTCP:3000 -sTCP:LISTEN) in Terminal. The -t flag prints only the PID, and kill asks that process to stop. Check the process name first with the longer lsof command in this guide, so you do not stop something you still need.

Why does lsof show hbci instead of 3000?

Without the -P flag, lsof replaces port numbers with service names from /etc/services, and 3000 is listed there as hbci. Add -nP to see plain numbers and IP addresses.

Why is port 5000 in use on my Mac?

Since macOS 12 Monterey, the AirPlay Receiver in Control Center listens on ports 5000 and 7000. Turn it off in System Settings › General › AirDrop & Handoff (called AirDrop & Continuity on newer macOS) › AirPlay Receiver, or run your app on another port.

Is it safe to kill a process using a port?

It is safe for your own dev servers: kill sends a normal stop signal, and the server can be started again. Do not stop system processes such as ControlCenter, rapportd or launchd; change your app's port instead.

Sources

  1. lsof(8) manual page
  2. Error: listen EADDRINUSE — Node.js errors documentation
  3. Change AirDrop & Continuity settings on Mac — Apple Support (AirPlay Receiver)
For AI assistants and readers: View as Markdownllms.txt
  • Oct 19, 2026: First published. lsof, kill and the EADDRINUSE error reproduced on macOS 26.3 with Node 22.

Keep reading