DiskwiseGet it for life$24

Free a port that’s already in use

Last updated December 1, 2026

“Address already in use” means something is still listening on the port your server wants, usually a dev server you forgot about. Here’s how to find the process using a port on a Mac, stop it safely, and deal with the ones that come back.

See what’s using the port

When a dev server says “address already in use”, something else is still listening on that port. Usually it’s a server from a terminal you closed or an editor that quit without stopping it. This shows what holds port 3000, with its process ID:

Terminal
lsof -nP -iTCP:3000 -sTCP:LISTEN

Change 3000 to your port. COMMAND is the program, PID its process ID and USER who started it. To see everything listening on your Mac at once:

Terminal
lsof -nP -iTCP -sTCP:LISTEN

Stop it

Ask it to quit first, so it can close its files and connections cleanly. Put the PID from lsof in place of 12345:

Terminal
kill 12345

If it’s still there after a few seconds, force it:

Terminal
kill -9 12345

Or find and stop whatever listens on a port in one line:

Terminal
lsof -t -iTCP:3000 -sTCP:LISTEN | xargs kill

Keep -sTCP:LISTEN in there. Without it the list also includes anything connected to the port, like the browser tab that has your app open. If the process belongs to another user, kill needs sudo, so check what it is before you force it.

When it comes straight back

Some servers are restarted as soon as they stop, so stop whatever is keeping them alive instead. Databases installed with Homebrew often run as services:

Terminal
brew services list

Stop one with brew services stop and its name. For a port held by a Docker container, docker ps shows which container maps it, and docker stop with the container’s name frees it. If a process manager like pm2 or nodemon started the server, stop the manager, or it starts the server again.

Ports macOS itself uses

AirPlay Receiver listens on ports 5000 and 7000, which Flask and some other tools use by default, and lsof shows it as ControlCenter. Don’t kill it. Turn off AirPlay Receiver in System Settings > General > AirDrop & Handoff, or run your server on another port.

How Diskwise handles ports

Diskwise’s Ports tab lists the servers listening on your Mac with their ports and the project folder each runs in, and opens one in your browser in a click. Stop ends a dev server and everything it started: it asks them to quit, and forces only what’s still running two seconds later. It remembers how the server was started, so Start again brings it back in the same folder.

It only stops servers you started. Services launchd keeps running, like Homebrew’s, come straight back, so Diskwise leaves them alone, and so it does ports that belong to apps like Docker or Control Center. Pin your main projects and you can start their servers from Diskwise any time, with what they print going to a log.

Rather not do it by hand?

Diskwise finds what fills your Mac, from build data to caches, and clears what’s safe in one click. The scan is free.