3

I know we can start an application from command line like:

 open -a "/Applications/Google Chrome.app"/

How can I quit that application from command line?

2 Answers 2

7
osascript -e 'quit app "/Applications/Google Chrome.app"'

As per this page.

Or, as per the comments,

osascript -e 'tell app "/Applications/Google Chrome.app" to quit'
3
  • Or tell app "Google Chrome" to quit.
    – slhck
    Commented Mar 4, 2015 at 19:52
  • @slhck what is the difference between quit app App and tell app App to quit? Commented Mar 4, 2015 at 20:21
  • None that I know of. Personal preference :)
    – slhck
    Commented Mar 4, 2015 at 20:26
-1

Since you know the name of the process, you can use killall:

$ killall "Google Chrome"
1
  • But you don't know the name of the process in the general case. open -a takes an .app path, and killall takes a UNIX executable name, in this case situated in the MacOSX subfolder. The name of the UNIX executable is defined in Info.plist and is not guaranteed to match the name of the .app. The easiest way to prove this is by renaming an application and trying to kill it using killall and the new name. There may also be oddball applications where the developer just chose a different name for the two things.
    – nitro2k01
    Commented Mar 5, 2015 at 9:57

You must log in to answer this question.

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