How to Find and Kill the Process Using a Port on Mac
Port 3000 already in use? Find out which process is listening on a port and stop it, with lsof and kill in Terminal, Activity Monitor, or the free Port Manager extension.
Port 3000 already in use? Find out which process is listening on a port and stop it, with lsof and kill in Terminal, Activity Monitor, or the free Port Manager extension.
You run npm run dev and get “EADDRINUSE: address already in use”. Somewhere on your Mac, an old dev server is still holding the port. Maybe it's a terminal tab you closed, maybe it's a process that never shut down properly.
The short answer: run lsof -nP -iTCP:3000 -sTCP:LISTEN in Terminal to see what's listening on port 3000, then kill followed by its PID. Or install the free Port Manager extension for Raycast, run Kill Process Listening on and type 3000.
Here's how each works, and the gotchas that make the usual copy-paste one-liner misbehave.
| Method | Best for | Shows all open ports | Kills by port in one step |
|---|---|---|---|
| Port Manager for Raycast | Everyday dev work, one keystroke | Yes, with exposure and process details | Yes |
lsof and kill in Terminal | Scripts, SSH sessions | Yes, with lsof -iTCP -sTCP:LISTEN | Yes, with a pipe |
| Activity Monitor | When you already know the app | No | No |
Port Manager has more than 65,000 installs. It lists every process listening on a TCP port and lets you kill it from the same list. It's free, open source, and works on Windows too.

3000, and whatever is listening on it is stopped. No list, no extra step.3000 (Next.js), so you recognize them in the list.Each port is tagged by color. Green means only your Mac can reach it, orange means anything on your network can, and blue means it's bound to one specific interface. The All Ports dropdown filters the list by that, which is a nice way to spot a dev server you accidentally exposed on café Wi-Fi.
A few things it does that a Terminal one-liner doesn't:
SIGKILL.SIGTERM or SIGKILL. Set the Kill Signal preference to always use one if you'd rather skip the question.nodemon or a watcher keeps bringing the server back.sudo kill -9 <PID> for processes you don't have permission to stop from Raycast.You can also just ask. In Raycast AI, type @, pick Port Manager and ask “what's running on port 5432?” or “free up port 3000”.
macOS ships with lsof, which lists open files and network connections, and kill, which sends a signal to a process.
Open Terminal (Applications → Utilities).
Run this, with your port number:
lsof -nP -iTCP:3000 -sTCP:LISTEN
The COMMAND and PID columns tell you what's on the port.
Run kill 48213, using the PID from step 2.
If it's still there after a few seconds, run kill -9 48213.
Or do it in one line:
lsof -ti tcp:3000 -sTCP:LISTEN | xargs kill
The flags matter more than they look:
-sTCP:LISTEN keeps only the process listening on the port. Plain lsof -i :3000 also lists anything connected to it, like the browser tab showing your app. Pipe that into kill and you close your browser along with the server.-P shows port numbers instead of service names. Without it, port 5432 shows up as postgresql, and searching the output for 5432 finds nothing.-n skips DNS lookups, which makes lsof noticeably faster.-t prints only PIDs, which is what makes the xargs kill pipe work.sudo is needed to see processes owned by other users or the system. Without it, lsof quietly shows only your own.To see every listening port at once, drop the port number:
lsof -nP -iTCP -sTCP:LISTEN
If the port is 5000 or 7000 and lsof shows ControlCenter, it's not your app. Since macOS Monterey, the AirPlay Receiver listens on both ports so other Apple devices can stream to your Mac. That's why Flask's default port has been "in use" on so many Macs.
Don't kill ControlCenter. Turn the receiver off instead:
If you use AirPlay to your Mac, leave it on and run your app on another port, like flask run --port 5001.
If you'd rather click than type, Activity Monitor can quit the process once you know its name or PID.
node, and double-click it.The catch: Activity Monitor can't search by port, and you'll often see five processes called node. That's what the other methods are for.
One more thing: if the port belongs to com.docker.backend, it's a Docker container. Killing it takes down all of Docker. Run docker ps to find the container and docker stop it, or use the Docker extension for Raycast.
Here's a quick tour of what else it can do, in under seven minutes:
Run lsof -nP -iTCP:3000 -sTCP:LISTEN in Terminal, replacing 3000 with your port. It shows the name, PID and user of the process listening on it. Add sudo in front to also see processes owned by other users or the system.
Find its PID with lsof -i :3000 -sTCP:LISTEN in Terminal, then run kill followed by the PID. If the process ignores it, use kill -9. With Raycast, run Kill Process Listening on from the free Port Manager extension and type 3000.
Since macOS Monterey, the AirPlay Receiver listens on ports 5000 and 7000, and lsof shows it as ControlCenter. Turn off AirPlay Receiver in System Settings → General → AirDrop & Handoff, or run your app on another port.
kill sends SIGTERM, which asks a process to quit so it can clean up first. kill -9 sends SIGKILL, which stops it immediately with no cleanup. Try kill first and only use kill -9 if the process won't quit.
Something is restarting it, like nodemon, pm2, a launchd service or Docker. Stop the parent instead: Port Manager has a Kill Parent action, and for Docker containers use docker stop rather than killing Docker itself.
See every open port and free one with a keystroke. Try Raycast with the free Port Manager extension.
Download
More guides
Find out what's slowing your Mac down. Check CPU and memory usage with Activity Monitor, a few Terminal commands, or the free System Monitor extension for Raycast.
Connect your AirPods, headphones, keyboard or mouse without digging through menus. Three ways to do it on a Mac: Control Center, System Settings, and the free Toothpick extension for Raycast.
Grab text from screenshots, images, videos and apps that won't let you select it. Three ways to do it: Live Text in Preview and Photos, the screenshot thumbnail, and the free ScreenOCR extension.
When an app freezes, press ⌥ ⌘ Esc to force quit it. Here's every way to quit and force quit apps on a Mac, from the keyboard, the Dock, Activity Monitor, Terminal and Raycast.
