Back to Volumora

Mac developer guide

Find What Is Using a Port on Mac (and Stop It Safely)

Updated 2026-09-28

When a development server says a port is already in use, identify the process before stopping anything. On macOS, lsof can show which process is listening on a TCP port, its process ID, and often the command that started it. Then you can decide whether to close the app normally or send it a graceful stop signal.

Download VolumoraLocal analysis, no file uploads
1

Find the process listening on the port

Replace 3000 below with the port from your error message. This asks lsof to show TCP sockets in the listening state. It does not change or stop anything.

Inspect TCP port 3000

lsof -nP -iTCP:3000 -sTCP:LISTEN

Inspect a different port

lsof -nP -iTCP:5173 -sTCP:LISTEN
  • COMMAND is the process name; PID is the process ID.
  • If there is more than one row, check every PID and command before taking action.
  • If there is no output, confirm the port number and whether the app uses UDP instead of TCP.
2

Check what started it

A PID by itself is not enough to decide what to stop. Look at the command and user in the lsof output. You can inspect the full process command line with ps. For Node projects, the command often identifies which repository owns the server.

Show process details

ps -p 12345 -o pid=,ppid=,user=,command=
  • Replace 12345 with the PID shown by lsof.
  • Check whether the terminal tab running the server is still open.
  • Look for another development server, simulator, container, or app that is expected to keep the port open.
3

Stop it gracefully first

If it is your own development server, return to the terminal where it is running and press Control-C. That lets the program shut down normally. If the terminal is gone, send SIGTERM to the specific PID only after checking it is the process you intend to stop.

Request a normal shutdown

kill -TERM 12345

Check whether it is still present

ps -p 12345 -o pid=,command=
  • Replace 12345 with the verified PID.
  • Wait a moment, then rerun the lsof command for the port.
  • If macOS reports Operation not permitted, do not switch to sudo automatically. Recheck the owner and use the account that started the process.
4

Use force quit only as a last resort

SIGKILL cannot be caught by an application, so the process cannot perform normal cleanup. If a process you own remains stuck after a graceful stop, verify the PID again and only then consider SIGKILL. Avoid broad commands such as killall node: they can stop unrelated projects and tools.

Last resort for one verified PID

kill -KILL 12345
5

Confirm the port is free and restart

Run the listener check again. No output means lsof found no TCP listener on that port at that moment. Start your project again from its normal directory. If the error returns, another process may have reclaimed the port, or the app may use a different host/port setting.

Verify port 3000

lsof -nP -iTCP:3000 -sTCP:LISTEN
  • Check for a new PID.
  • Review your framework's port setting and any PORT environment variable.
  • Use your framework's documented port override instead of killing processes repeatedly.
6

Why EADDRINUSE happens

EADDRINUSE means the requested address is already occupied when an app attempts to listen. A previous development server is one common cause, but a different app can own the same port. The message does not tell you that the existing process is safe to terminate; inspect its identity first.

7

Keep track of servers by project

If forgotten local servers are a recurring problem, Volumora's Projects view groups detected development servers by project folder, shows their ports and memory use, and marks idle processes. You review and confirm before stopping one.

See Volumora Projects
8

Read the manuals installed with macOS

Command options can vary across systems. These built-in manuals describe the lsof, kill, and ps versions installed on your own Mac.

lsof options

man lsof

kill signals

man kill

process details

man ps

Frequently asked questions

Is it safe to kill a process using port 3000?

Only after identifying it and confirming it belongs to a server you intend to stop. Close your own server normally with Control-C when possible.

Why does lsof show more than one row?

A process can have multiple matching sockets or address families. Compare the PID and command, and do not assume each row is a different app.

Can I use Activity Monitor to find the port?

Activity Monitor helps inspect and quit apps, but lsof is the direct way to map a listening TCP port to a process. Identify the process before using Force Quit.

What if lsof prints nothing?

Confirm the port number, check that the server is still running, and verify whether it listens on TCP. A port can become free between the error and your inspection.