How to Kill a Process on macOS

In this quick guide, we will show you how to kill a process on macOS.

macOS kill process using terminal

Knowing how to kill a process on macOS is a crucial way to help deal with problematic applications.

When you kill a process on your Mac, it is the equivalent of force quitting it. The process doesn’t get the chance to close safely, so it is only something you should do when dealing with a process that won’t exit normally.

There are a couple of ways that you can use to kill a running process on macOS. The first is to use the kill command within the terminal. The second is to use the inbuilt activity monitor. If you have used Windows before, the Activity Monitor is the equivalent of the “Task Manager“.

For this particular guide, we will focus on how to kill a process from the terminal. This is definitely the harder way of stopping a running process, as you need to know the process ID.

We also have a guide that shows you how to kill a process that is running on a particular port. This is a useful alternative if you are trying to free up access on a specific port.

Using the Terminal to Kill a Process on macOS

In the following sections, we will show you how to use the terminal to kill a process on macOS and how to list any running process to get the required ID.

Opening the Terminal

1. The most straightforward way to open the terminal is to use the spotlight feature of macOS.

You can open spotlight by pressing COMMAND + SPACEBAR.

Open Spotlight

2. With spotlight open on your device, type in “terminal” and press the ENTER key.

Open the terminal

Listing Processes You Can Kill on macOS

3. Now that the terminal is open, you will want to use the top or ps command to list running processes and their ID.

For this example, we will use the top command to get the ID of the process you want to kill on your macOS system.

The top command is a great tool for finding the ID of processes you want to kill, as it lists them by their memory or CPU usage.

top

By default, this list is sorted by CPU usage. However, you can press SHIFT + M to change it to sort by memory instead.

The value you will want is in the first column labeled “PID“. You can identify an application by the name in the second column labeled “command“.

Once you have found your process ID, press the Q key to quit.

Find process ID to kill on macOS
Screenshot

4. Alternatively, you can use the ps command to take a snapshot of all running processes. This can make searching for applications you can kill and their process IDs easier.

ps aux

Below, you can see a list of processes. The value you are after is in the second column.

USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
emmet      34392  0.0  0.0   8384  4608 pts/1    Ss   Aug14   0:00 -bash
emmet    1023696  0.0  0.0  11440  4096 pts/1    R+   14:27   0:00 ps aux
emmet      34392  0.0  0.0   8384  4608 pts/1    Ss   Aug14   0:00 -bash
root         866  0.0  0.1  16688  8704 ?        Ss   Aug14   0:00 sshd: /usr/sbin/sshd -D [listener] 0 of 10-
root         683  0.0  0.0   6880  2048 ?        Ss   Aug14   0:00 /usr/sbin/cron -f

Killing a Process on macOS

5. Once you know the process ID, killing said process is now incredibly easy on your macOS device.

All you need to do is use the “kill” command, followed by the signal “-9” and then finally the ID of a process.

The “-9” signal refers to “SIGKILL“. This signal immediately terminates the running process without giving it a chance to stop gracefully. Only use this signal when you are certain a process won’t close normally.

sudo kill -9 <PID>

6. For example, if we wanted to kill a process with the ID “1023703“, we would use the following command on your Mac.

This will kill the process immediately. If the process was killed successfully, you won’t see any response within the terminal after running this command

sudo kill -9 1023703

Conclusion

Hopefully, at this point in the guide, you will now understand how to kill a process on your Mac using the terminal.

Knowing how to kill a process within the terminal is crucial for helping manage your system, especially if you are using SSH.

Please feel free to drop a comment below if you have any questions about how you can kill a process within the terminal on macOS.

If you like this guide, we highly recommend that you check out our many other macOS tutorials.

Leave a Reply

Your email address will not be published. Required fields are marked *