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?
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'
quit app App
and tell app App to quit
?
Commented
Mar 4, 2015 at 20:21
Since you know the name of the process, you can use killall
:
$ killall "Google Chrome"
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.
Commented
Mar 5, 2015 at 9:57