How to kill a process on a port on a Mac
To free a port on a Mac, find the process using it with lsof -i :3000 in Terminal, note the number in the PID column, and stop it with kill followed by that number. Replace 3000 with the port you need.

Find the process
Open Terminal and run lsof -i :3000. The output lists the command name and its PID. To show only processes that are listening, use lsof -nP -iTCP:3000 -sTCP:LISTEN.
Stop it
- Run kill followed by the PID. This asks the process to stop cleanly.
- If it is still running after a few seconds, run kill -9 followed by the PID to end it at once.
- Run the lsof command again to confirm the port is free.
In one line
kill $(lsof -ti tcp:3000 -sTCP:LISTEN) finds and stops the program listening on port 3000. The LISTEN part matters: without it the command also stops anything connected to that port, such as a browser tab open on localhost:3000. Add -9 after kill only if the plain version does not work.
Why port 5000 or 7000 is already in use
On macOS Monterey and later, AirPlay Receiver listens on ports 5000 and 7000. It shows up as Control Center in lsof. Turn it off in System Settings, under General, then AirDrop and Handoff, or use a different port for your server.
The quicker way, with Activity+
The Developer tab in Activity+ lists every dev server and database with its port, the project folder it was started in, how long it has been running and how much memory it holds.
Each one has a Stop button. It also points out a server that has been left running for hours, and lists the ports that ordinary apps and macOS have open.
Docker containers are listed with their image, published ports, CPU and memory, each with a Stop button, and Homebrew services running in the background are listed too.
From Terminal, activityplus ports prints the same list, and with --json a script can read it.
Questions people also ask
How do I see what is running on a port on a Mac?
Run lsof -i followed by a colon and the port number, such as lsof -i :8080. It shows the command, its process ID and the user that owns it.
What does "address already in use" mean?
Another process is already listening on that port. Find it with lsof and stop it, or start your server on a different port.
Is it safe to use kill -9?
It works, but the process gets no chance to clean up. Try plain kill first and use -9 only when a process refuses to stop.
Related guides
More guides
How to force quit on a MacHow to open Task Manager on a MacHow to clear cache on a MacWhat is System Data on a Mac, and how do you clear it?How to check CPU usage on a MacMacBook overheating: how to find the causeHow to check battery health on a MacBookWhat is WindowServer on a Mac?How to check GPU usage on a MacHow to check Bluetooth battery levels on a MacHow to see which app is using the microphone on a MacDoes Activity Monitor keep a history? How to see what slowed your Mac earlierHow to get a system monitor in your Mac menu barHow to check your Claude Code usage and limitsHow to change the volume of one app on a MacWhat is Ctrl+Alt+Delete on a Mac?Why is my Mac so slow?
Updated 24 November 2026. Written for macOS 14 Sonoma and later by Almas Malik, who makes Activity+.