How to Quit an Application via a Mac OS X Terminal

By David Weedmark

Updated August 23, 2018

Terminal can give you insight into which applications are stuck.
i Justin Sullivan/Getty Images News/Getty Images

When an application freezes, shutting down your Mac isn't always a good option, especially when there are unsaved documents open in other windows. Using Terminal is an option to force quit applications using its command line interface. Terminal also has a utility called "top" that you can often use to pinpoint the process behind the problems and force it to quit without affecting other applications.

Launch Terminal on your Mac computer. Click "Applications" in the left column of a Finder window followed by "Utilities," and then double-click "Terminal." Alternatively, launch Terminal from Spotlight by pressing the "Command" button and "Space Bar" at the same time. You can then just type "terminal" in the Spotlight search field and press "Enter."

Wait a second or two for Terminal to load. When it shows the name of your Mac and your username followed by a rectangle, you can begin typing. The rectangle indicates the cursor.

Type "top" and press "Enter." Terminal displays information about all of the processes, including applications, running on the computer. A summary of the Mac's processes appears at the top, including the total number of running processes, how much of the CPU and memory is being used and how much data is being sent and received over the network. Beneath this is a table displaying the processes running on the Mac.

Press the down arrow key to scroll through the table until you see the application you are looking for. Expand the Terminal window if needed by dragging the bottom right corner if you want to see the state of each process listed in the State column. In this column, applications are listed as being sleeping, running or stuck.

Look for the application you want to quit in the Command column, which is second from the left. When you find the application you want to quit, look at the State column to see if it is running, sleeping or stuck. There may be more than one instance of an application listed. If you have two Safari windows open, for example, one may be running and one may be stuck. You can choose to quit the stuck instance without losing the other one.

Make a mental note of the PID number beside the application name in the first column. Press "Q" on the keyboard to exit from top. The terminal screen clears.

Type "kill" followed by a space and the PID number of the application, such as "kill 123." Press "Enter." This force quits the application using that PID.

Force quit all instances of an application by typing the "killall" command followed by the application name in Terminal. For example, if you have multiple windows and tabs open, there may be several instances of Safari listed in top. You could then type "killall Safari" to force quit all instances of Safari.


Some processes are responsible for more than one application. Even if top identifies a process as being stuck, you shouldn't try to force quit it unless you know what the process is used for. If you do need to force quit a process and you don't know what the process is for, restart your Mac as soon as you are able to.