What's using this port?

Get the exact Terminal commands to find and stop whatever is holding a port on your Mac.

Port 3000 is often used by Next.js, Rails, Create React App, and many Node servers.

See what's listening
lsof -nP -iTCP:3000 -sTCP:LISTEN
Its full command and how long it's been running
ps -o pid,etime,command -p $(lsof -t -iTCP:3000 -sTCP:LISTEN | paste -sd, -)
Its project folder
lsof -a -p $(lsof -t -iTCP:3000 -sTCP:LISTEN | paste -sd, -) -d cwd -Fn | grep ^n
Ask it to stop (like Control-C)
kill $(lsof -t -iTCP:3000 -sTCP:LISTEN)
Force it to stop, if it ignores that
kill -9 $(lsof -t -iTCP:3000 -sTCP:LISTEN)

When you need this

An error like EADDRINUSE or “Port 3000 is already in use” means another process is listening on that port, usually a development server you started earlier and forgot about.

Reading the result

The first command prints a line per listening process with its COMMAND and PID. System processes like rapportd or ControlCenter belong to macOS: leave those alone. On macOS, AirPlay Receiver uses ports 5000 and 7000; turn it off in System Settings → General → AirDrop & Handoff if you need them.

lsof -nP -iTCP -sTCP:LISTEN    # everything listening, on every port

Updated 25 September 2026