How can I quit an app using Terminal?

I want to quit certain applications on my Mac using Terminal. For example, how do I kill “Slack”? Do I need its PID number?


No, you do not need to know its PID.

You can use:

pkill -x Slack

Or:

killall Slack

Note: Be sure to read the manual page for whichever command you choose to use, in order to see the various options available to the command, as may be relevant to its particular usage. In Terminal type e.g. man pkill and press enter, or just type the command and right-click on it, then select: Open man Page


You can use AppleScript to tell the application to quit:

osascript -e 'quit app "Slack"'

this will tell the application to quit and will start all the save and cleanup tasks. Or you can send the TERM signal with pkill but it could be that the application will not shut down cleanly

pkill -x Slack

Since I don't yet have the reputation to comment, I'm saying this as a separate answer. pkill without any flags does not match a specific process! For example, running pkill foo would target processes named foo, but would also target processes named foobar. This is because it uses regular expressions.

If you wish to kill a specific process, you can pass it the -x flag. For example, pkill -x foo. This will use exact names instead of regular expressions.

For example, in your case, pkill -x Slack will do the trick.


You can install htop (via brew for instance).

You'll need to run this as root or with sudo. Essentially, it's a text based Activity Monitor.

Select the process you want to kill (either with arrow keys or a mouse).

Then press k to send the process a signal and then 9 to choose the SIGKILL signal.