I'm on macOS Monterey and this is the system Force Quit menu:

enter image description here

I know how to quit or kill an app from command line, either using osascript or kill / killall - but they don't do the exact same thing the system Force Quit menu does.

Can I force quit an app using the same machanism the system Force Quit menu uses from command line?

  • 3
    How do you see Force Quit differ from kill?
    – nohillside
    Aug 16, 2022 at 4:21
  • @nohillside I'm not sure if there's a difference. I think macOS knows the processes an app is associated with and using the Force Quit menu cleanly kill -9 them all. To do that without the FQ menu I'd have to find all those processes myself, and I might leave some process behind.
    – Teddy C
    Aug 16, 2022 at 4:50
  • I'd like to know more about the workflow in which killing apps on the command line is happening. What problem are you trying to solve?
    – benwiggy
    Aug 16, 2022 at 6:34
  • 1
    kill is a lot more manageable once you know about pgrep -lafi and its close cousin, pkill. They're not as clean as Force Quit, but get you most of the way.
    – JL Peyret
    Aug 16, 2022 at 7:40
  • @benwiggy I sometimes need to quit an app but the app doesn't respond to cmd-Q or osascript's tell my.app to quit well (it hangs), and I have to force quit it.
    – Teddy C
    Aug 16, 2022 at 8:08

1 Answer 1


Try using the pgrep / pkill combo.

  1. Tune your search with pgrep first. I'll nuke Firefox here.

pgrep -lafi firefox

(truncating with | head | cut -c-50):

34536 /Applications/Firefox.app/Contents/MacOS/fir
34539 /Applications/Firefox.app/Contents/MacOS/plu
34540 /Applications/Firefox.app/Contents/MacOS/plu
34541 /Applications/Firefox.app/Contents/MacOS/plu
34544 /Applications/Firefox.app/Contents/MacOS/plu
34549 /Applications/Firefox.app/Contents/MacOS/plu
34550 /Applications/Firefox.app/Contents/MacOS/plu
34551 /Applications/Firefox.app/Contents/MacOS/plu
34557 /Applications/Firefox.app/Contents/MacOS/plu
34583 /Applications/Firefox.app/Contents/MacOS/plu
  1. just switch to pkill, keeping same arguments:

(Kinda like doing ls <complicated patter> before running rm <complicated pattern>)

pkill -lafi firefox

(this was a different run which is why the PIDs differ)

kill -15 390
kill -15 509
kill -15 671
kill -15 25256
kill -15 25265
kill -15 25296
kill -15 25303
kill -15 25309
kill -15 26301
kill -15 26306
kill -15 26307
kill -15 26308
kill -15 34489
kill -15 41143
kill -15 41498
kill -15 50615
kill -15 97395

pkill takes extra stuff too: pkill -9

p.s. re. a comment: As to why someone's workflow would prefer command line over Force Quit? Their business, init? Many people are more productive on shells. Doesn't have to be a malfunction either: in my case, it might be an npm run watch server daemon that I want to launch to test, and then kill. And that puppy doesn't show up on F Q.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .