Get rid of what's slowing it down
The Terminal app on the Mac can help identify which ancillary services and processes running in the background may be causing your Mac to slow down. The Terminal application helps the user get inside macOS via a command line interface. While typing in the commands in Terminal ensure that spaces, characters and capitalizations are accurate.
Note: For this guide, we’re using a MacBook running macOS Big Sur.
How to Kill a Process Using the Mac Terminal Application
The basic steps required to kill a process using Terminal:
- Backup your files and folders
- Launch Terminal application
- View the list of running processes
- Find the process you want to close
- Kill the process using a Terminal command
1. Backup Your Files and Folders
It may be a good idea to backup your data, files and folders using Time Machine, to avoid having to restore your Mac from a backup because of accidental deletion. Time Machine is easy to set up and use.
With Time Machine, you can also go back in time and see what a file looked like in the recent past. Check out the link above to read our article on setting up Time Machine.
2. Launch the Terminal Application
There are several options you can use to open Terminal on your Mac, which includes using a keyboard shortcut, Launchpad, or open Terminal from the Applications folder.
- To launch Terminal using a keyboard shortcut, press Command + Spacebar to open Spotlight. Search for Terminal and double-click on it to open the application.
- You can also open Terminal through the Launchpad. Select Launchpad on the Dock, select Other folder and then select Terminal.
- Alternatively, navigate to Go on the menu bar, select Utilities and then double-click Terminal to launch it.
A standard Terminal window will open showing the date and time you last logged in, and the command prompt where you’ll type the command you want to execute. You’ll also see the current (working) directory that defaults to your Home Folder.
3. View the List of Currently Running Processes
If you want to quickly view all the active processes on your Mac, you can open the Activity Monitor and see each process sorted by its CPU usage. You can also see the same processes ranked by the amount RAM used in the Memory tab.
Follow the steps below to view processes in Terminal.
- Type top in the Terminal window you just launched and you’ll see a list of processes currently running and the resources they’re consuming.
- You can also type ps -ax to list the running processes along with their PIDs, elapsed time running, process name and location.
4. Find the Process You Want to Close
You can quickly identify a process from the process list based on the PID or the name in the CMD column. You can use the following methods to find the PID:
- Check the Activity monitor and scroll down to find the relevant process in the Terminal window.
- Use the grep command to find a process by its PID or its name and filter out the desired information. You can use the grep command together with the ps ax command to list only the process you want to kill.
- For example, you can type ps ax | grep GarageBand to find GarageBand instead of looking for it among the hundreds of currently running processes on your Mac.
The result you may see will look something like this:
This example shows that Garageband has a PID of 547 and also the folder where Garageband was launched from.
5. Kill the Process Using a Terminal Command
You can Force Quit the application by using the Command + Option + Esc key combination, but only individual apps are listed in the Force Quit Applications window instead of all the processes running on your Mac.
- To kill an unwanted process, note down the PID of the process and then type kill <Process PID number> in Terminal. Press Enter and the process will exit immediately. For example, to kill GarageBand, we’ll type kill 547.
- Alternatively, you can use the killall command to kill a process by its name and kill all the processes containing its name. For example, killall GarageBand will terminate all processes that have GarageBand in their name.
Note: Check the processes carefully before using the killall command.
Force Quit Unresponsive Applications
Terminal is a quick way to force quit a process or program in macOS if the program fails to respond or unexpectedly hangs. Hopefully, the steps mentioned above resolve your issue. If the issue resurfaces, consider updating the application or finding an alternative application.
Did this guide help you kill a troublesome process on your Mac? Share with us in a comment below.