# How to Find and Kill the Process Using a Port on Mac

URL: https://www.raycast.com/guides/how-to-kill-a-process-on-a-port-on-mac
Published: 2026-11-16
Updated: 2026-11-16
Description: 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](https://www.raycast.com/lucaschultz/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                        |

## Kill the process on a port with Raycast | The quickest way

### [Port Manager: see every open port and free one in a keystroke](https://www.raycast.com/lucaschultz/port-manager)

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.

![Open Ports shows what's listening on each port, and whether it's reachable from your network.](https://www.raycast.com/uploads/how-to-kill-a-process-on-a-port-on-mac/how-to-kill-a-process-on-a-port-on-mac.png)

- **Open Ports**: every listening process with its ports. Type a port number to filter, then press Enter to kill it.
- **Kill Process Listening on**: type a port, like `3000`, and whatever is listening on it is stopped. No list, no extra step.
- **Named Ports**: give ports a label, like `3000 (Next.js)`, so you recognize them in the list.
- **Open Ports in Menu Bar**: your open ports in the menu bar, refreshed every minute, with a kill option for each.

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.

> Pro tip: give **Kill Process Listening on** an [alias](https://manual.raycast.com/command-aliases-and-hotkeys) in Raycast's settings, like `kp`. Then `kp 3000` and Enter frees the port without leaving your editor for more than a second.

A few things it does that a Terminal one-liner doesn't:

- **It checks the process actually died.** A kill is only reported as successful once the process has exited. If it ignores the signal, you get a **Force Kill** button to follow up with `SIGKILL`.
- **You pick the signal.** By default, **Kill…** asks whether to use `SIGTERM` or `SIGKILL`. Set the **Kill Signal** preference to always use one if you'd rather skip the question.
- **Kill Parent** (⌥ ⌘ P) stops the process that started the listener. That's the one you want when `nodemon` or a watcher keeps bringing the server back.
- **Copy Commands…** copies a ready-made `sudo kill -9 <PID>` for processes you don't have permission to stop from Raycast.

You can also just ask. In [Raycast AI](https://manual.raycast.com/ai/ai-extensions), type `@`, pick Port Manager and ask “what's running on port 5432?” or “free up port 3000”.

## Use lsof and kill | Built in: Terminal

macOS ships with `lsof`, which lists open files and network connections, and `kill`, which sends a signal to a process.

1. Open **Terminal** (Applications → Utilities).
2. Run this, with your port number:

   ```bash
   lsof -nP -iTCP:3000 -sTCP:LISTEN
   ```

   The `COMMAND` and `PID` columns tell you what's on the port.

3. Run `kill 48213`, using the PID from step 2.
4. If it's still there after a few seconds, run `kill -9 48213`.

Or do it in one line:

```bash
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:

```bash
lsof -nP -iTCP -sTCP:LISTEN
```

> Pro tip: try a plain `kill` before `kill -9`. `SIGTERM` lets a server close database connections and delete lock files. `SIGKILL` doesn't, and that's how you end up with a stale `postmaster.pid`.

## Port 5000 or 7000 in use | Built in: System Settings

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:

1. Open **System Settings → General → AirDrop & Handoff**.
2. Turn off **AirPlay Receiver**.

If you use AirPlay to your Mac, leave it on and run your app on another port, like `flask run --port 5001`.

## Quit the app | Built in: Activity Monitor

If you'd rather click than type, Activity Monitor can quit the process once you know its name or PID.

1. Open **Activity Monitor** (Applications → Utilities).
2. Search for the process name, like `node`, and double-click it.
3. Open the **Open Files and Ports** tab to check it's the one using your port.
4. Click **Quit**, then **Quit** again, or **Force Quit** if it doesn't respond.

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](https://www.raycast.com/priithaamer/docker) extension for Raycast.

## New to Raycast?

Here's a quick tour of what else it can do, in under seven minutes:

[Video: 102 Things You Can Do With Raycast 2.0](https://www.youtube.com/watch?v=G7_7F_FBqQE)

## Frequently Asked Questions

### How do I see what is using a port on my Mac?

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.

### How do I kill the process on port 3000 on a Mac?

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`.

### Why is port 5000 already in use on my Mac?

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.

### What is the difference between kill and kill -9?

`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.

### Why does my port come back after I kill the process?

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.
