Skip to content
86% off$349 $48.86code BF2026

Guides

How to Kill a Process by Name on Mac (Terminal and sudo)

Kill a Mac process by name with killall, pkill or Activity Monitor. Covers sudo for root-owned processes, kill -9 as a last resort, and why it comes back.

GuideUpdated 7 min read

On this page

You have a hung process, you can kill it by hand in Activity Monitor, and you want the Terminal version. A typical case: a Python process hangs and a plain killall Python finds nothing, because that Python belongs to root. People on Q&A sites report that sudo killall Python is the answer in that case.

Why a plain killall sometimes does nothing

You can only signal your own processes. When a process is owned by root or another user, killall reports No matching processes belonging to you were found, which looks like a wrong name but is really a permissions limit. The causes, most common first:

  1. Wrong name. Names are matched exactly, including capitalization. python3 and Python are different.
  2. Wrong owner. The process runs as root or another user, so you need sudo.
  3. The process ignores SIGTERM. killall sends SIGTERM by default, which asks a process to exit. A hung process may not respond.
  4. Something restarts it. A launch agent, a daemon or a parent process respawns it, so it seems unkillable.
  5. It is a zombie or stuck on I/O. It cannot be removed by any signal until its parent or the I/O gives way.

Step-by-step fixes

1. Kill by name with killall

bash
killall Python

This sends SIGTERM to every one of your processes named Python. It signals all matches, not just the hung one. If three node processes are running, all three get the signal. It also works on apps: killall Finder and killall Dock both relaunch automatically, a common way to reset them.

To see what matches first, run:

bash
pgrep -lx Python

pgrep lists matching processes with PIDs. -x requires an exact name and -l prints the name beside each PID. Nothing is changed.

2. Use sudo for root-owned processes

bash
sudo killall Python

sudo runs the command as an administrator. It asks for your password and shows nothing as you type. Your account must be an administrator.

To check the owner first:

bash
ps -axo pid,user,comm | grep '[P]ython'

This lists every process with PID, owner and name, keeping only lines containing Python. The brackets stop grep from matching itself. If the owner column says root, you need sudo.

3. Kill one process by PID

When several processes share a name and you want only one, use its PID. Get it from pgrep -l Name, Activity Monitor's PID column, or the ps command above.

bash
kill 4242

Replace 4242 with the PID. This sends SIGTERM to that one process; add sudo for a root-owned one. PIDs are reused after a process exits, so confirm the PID still belongs to the process you meant right before you send the signal.

4. Match the full command with pkill

A script run as python3 server.py shows up under the interpreter's name, so a name match hits every Python script you have running. pkill -f matches the whole command line:

bash
pkill -f server.py

This sends SIGTERM to processes whose full command line contains server.py. Without -f, pkill matches part of the process name, so pkill node can also hit other names containing "node". Add -x to require an exact name.

5. When it ignores you: kill -9

Give a hung process a few seconds after SIGTERM, then use SIGKILL.

kill -9 ends the process immediately with no cleanup. Unsaved work in it is lost, and it can leave temporary files or locks behind.

bash
killall -9 Python

Or by PID:

bash
kill -9 4242

Put sudo in front of either if the process is root-owned. There is nothing to undo, except that you can start the program again.

If even -9 fails, check the state with ps -axo pid,stat,comm. A state starting with Z is a zombie: it is already dead and waiting for its parent to collect it, so quit the parent instead. A process stuck waiting on a disk or network mount can resist SIGKILL until the I/O returns or you restart.

6. Kill it from Activity Monitor

  1. Open Activity Monitor (search for it in Spotlight).
  2. Choose View and then All Processes, so processes owned by other users are listed.
  3. Type the name into the search field, or click a column header to sort.
  4. Select the process and click the stop button (an X in an octagon) in the toolbar.
  5. Choose Quit to ask it to exit, or Force Quit if it ignores that.

Apple's Activity Monitor user guide covers the app in full. For a tour of each tab, see how to use Activity Monitor. For apps that won't close, see how to force quit on a Mac.

Which method to use

MethodKills by nameRoot-owned processesAsks first
killall NameYes, all matchesWith sudoNo (add -I to be asked for each process)
pkill -f textBy command lineWith sudoNo
kill <pid>No, one PIDWith sudoNo
Activity MonitorSearch, then selectSet View to All ProcessesYes
Procowl command paletteYes, you pick the matchNoYes

If the process is yours and you want only one, kill <pid> or the palette is the safest. If it is root-owned, use sudo in Terminal.

Kill by name in Procowl (your own processes only)

Procowl is our process monitor. Its command palette accepts commands much like the ones above, with a confirmation dialog. It covers your own processes only, so it does not replace sudo for a root-owned one.

  1. Press ⌘K (Command-K) in Procowl.
  2. Type a command such as kill node, force kill node or suspend node.
  3. Pick the match with ↑/↓ and press Return.
  4. Confirm in the dialog.

You pick one match, so unlike killall it acts only on the process you chose. The palette also understands signals, such as kill -HUP nginx. kill maps to Quit: a command-line process gets SIGTERM, and a regular app is asked to quit as if you had chosen Quit from its menu. force kill maps to Force Quit, which sends SIGKILL to non-app processes. You can also right-click a process row for Quit…, Force Quit… and Send Signal.

Procowl cannot quit, force quit, suspend or signal root-owned or other users' processes, even with the optional Enhanced Access helper. Trying shows "Permission denied. The process belongs to another user or is protected by the system." For a root-owned Python, use sudo in Terminal. Procowl's procowl stop <pid> command-line tool also takes a PID, not a name.

Procowl is part of MacSuite and needs macOS 14 Sonoma or later. It runs free for 7 days.

Checklist before you try again

  • The name matches exactly, including capitalization (check with pgrep -lx Name).
  • You checked the owner with ps -axo pid,user,comm.
  • You used sudo if the owner is root or another user.
  • You waited a few seconds after SIGTERM before using -9.
  • You know what the process is and that it is safe to end.

If nothing works

Most stubborn cases are respawning processes, zombies or I/O waits, not a typing mistake.

  • It comes straight back: Something restarts it, often a launch agent or daemon set to keep it alive, or a parent that respawns it. Quit or remove the app that owns it rather than killing it repeatedly. In Procowl, the inspector's Launched by line points to the matching launchd file, and the Launch Agents section lists them read-only. See launch agents and daemons on Mac.
  • Operation not permitted from kill <pid>: The process isn't yours. Use sudo. If that still fails, leave it alone and look at the app or service that owns it.
  • It survives kill -9: Check for a zombie (state Z) or blocked I/O, as above, then restart the Mac if needed.

If the process is part of an app that keeps misbehaving, contact that app's developer. For a macOS process, contact Apple Support. Include the process name, its owner, the commands you ran and the output.

text
Hi, a process named "Name" (PID 4242, owner root) hangs on my Mac.
macOS version: 
What I tried: killall Name, sudo killall Name, sudo kill -9 4242.
Result: (paste the exact output or error)
It respawns after about 5 seconds / it stays in state: (paste ps output).
Please advise on what is restarting it or why it can't be ended.

Common questions

What is the difference between kill and killall?

kill takes a PID and signals one process. killall takes a name and signals every process with that name.

Is killall the same as Force Quit?

Not by default. killall Name sends SIGTERM, a request the process can handle. killall -9 Name sends SIGKILL, which like Force Quit ends it immediately without cleanup.

How do I pause a process instead of killing it?

kill -STOP <pid> pauses a process and kill -CONT <pid> resumes it. Procowl's Suspend… and Resume do the same for your own processes.

How do I free a port by killing what's using it?

See how to kill a process on a port on Mac.

Every app.
One purchase.