← Back to Blog

Port Already in Use on Mac: Find and Fix It

Any "port already in use" error on Mac comes down to one thing: another process holds the port. Here's the universal three-step fix that works for 3000, 8080, 5000, or any port.

“Port already in use,” “address already in use,” EADDRINUSE, “port 3000 is already allocated”, they’re all the same problem wearing different words. A process already holds the port you want. This is the one method that fixes every version of it on a Mac, regardless of the port or the program.

The universal cause

Only one program can listen on a given port at a time. When a second program tries to bind to a port that’s already taken, the operating system refuses, and whatever you’re running translates that refusal into its own error message. The wording changes; the cause never does.

So the fix is always the same three steps: find what’s on the port → free it or change yours → confirm.

Step 1: Find what’s holding the port

Swap in your port number:

sudo lsof -i :3000 -n -P
COMMAND   PID   USER   ...  NODE NAME
node     1421  aaron   ...  TCP *:3000 (LISTEN)

That single line tells you everything you need: the program (node), its PID (1421), and that it’s LISTENing on port 3000. If you only care about the process name, see which app is using a port on Mac.

If lsof returns nothing but you still get the error, the port is likely stuck in TIME_WAIT from a recently closed connection, covered in address already in use.

Step 2a: Free the port (if it’s safe to stop)

If the process is an old dev server or a forgotten script, kill it. The one-liner:

kill -9 $(lsof -ti :3000)

Prefer a graceful stop first, it lets the process clean up before exiting:

kill $(lsof -ti :3000)

Reach for -9 (SIGKILL) only if the graceful kill (SIGTERM) doesn’t work. The difference matters for anything with unsaved state, see kill a process by port on Mac.

Step 2b: Or change your app’s port (if it isn’t)

When you can’t identify what holds the port, or it’s a system service, don’t kill it, move your own app instead:

# Node
PORT=3001 npm start

# Vite (in vite.config or CLI)
npm run dev -- --port 5174

# Flask
flask run --port 5001

# Rails
rails server -p 3001

Changing your port is the safer default whenever you’re unsure what the other process is.

Step 3: Confirm it worked

Re-run the lookup. Nothing should come back:

lsof -i :3000 -n -P

An empty result means the port is free and your app will start.

The common offenders

Most “port already in use” errors trace back to a short list of usual suspects:

One macOS-specific gotcha: port 5000 and 7000 are often held by AirPlay Receiver, not a program you started. If you can’t find your process on 5000, that’s usually why, turn off AirPlay Receiver in System Settings or just use a different port.

Find and fix it without the terminal

Portie shows every open port on your Mac and the exact process holding each one, in a live table refreshed every 3 seconds. When you hit “port already in use,” you can see what’s on the port at a glance and end it with one click, no lsof, no copying PIDs.

Local monitoring is free. The $8.99 one-time unlock adds one-click process termination (graceful or forced) and remote port scanning. Download Portie and resolve port collisions in seconds.

Try Portie Free

See every open port on your Mac, which app owns it, and kill processes from the list.

Download Free