Quit applications politely from the command line | 11 comments | Create New Account
  1. Jun 04, 2016 Here's what it looks like with the Mac Automator on Mac OS X 10.5: 3) Find the 'Quit All Applications' action. Next, on the left side of the Mac Automator, search for the Automator Quit All Applications action. In my case I found it by searching for the word 'quit', as seen here: 4) Add the Quit All Applications action to your workflow.
  2. Right click the app's icon in the Dock and select Quit Run the Activity Monitor.app, identify the misbehaving app, and terminate it. With some expertise, open a terminal window and terminate the.
  3. Force Quit with Mac Shortcut. To do the same thing but faster, use Mac shortcut keys to close frozen applications. On your keyboard, press and hold Command + Option + Esc. It will immediately bring up a “Force Quit Application” window. Select the frozen application from the dialogue box and select “Force Quit.”.
  4. Mac OS X is almost always very stable, but sometimes you may encounter an app that is not so stable. Some apps may become frozen, unresponsive, or stuck. This short tip explains how to force an application to quit. Note that when you force close an application, any unsaved changes may not be saved.
Click here to return to the 'Quit applications politely from the command line' hint

Resign An Mac Os X App Store

The following comments are owned by whoever posted them. This site is not responsible for what they say.

In the upper-left corner of the Activity Monitor window, select the “X.” Related: How to Open Any Folder from the Mac Terminal. If you’re dealing with an application that won’t respond to the previous force quit methods, then the kill command (learn more about the Kill command here) can shut the app down hard.

Very nice, thank you!

This script is well done and may be useful to some people. But automatically overwriting open files when you quit an application remotely isn't always 'polite.' Your cat might have been sleeping on the keyboard while you were away from your desk. If you send a kill signal to an application, at least you can be sure that no stored data has been overwritten.

That's a good point. Maybe I'll put out a new version with an option not to save.

I've just uploaded version 1.1 which includes an -n option that tells the app not to save changes.

Is it really such that OS X applications (which ARE processes, otherwise they wouldn't appear in 'ps' listings) do not catch SIGTERM/SIGINT and such to shut down cleanly? Really!?
To me this seems hard to imagine. But then I don't know better.

Yes, really. For example, the command one might expect to work as desired, killall -QUIT TextEdit, produces an error message saying 'The application TextEdit quit unexpectedly.' By all means feel free to play around with the various kill signals, but from what I can find, none of them perform the same way as pressing ⌘Q when using the application.

Obviously every application has a process at its core, so you will see at least one process for each application, but an application is more than just a process.

I just tried it: 'killall -TERM TextEdit' works as I expect, producing no error message but just telling TextEdit to die asap. 'killall -QUIT' indeed does behave different. But SIGTERM is what's usually sent if you do not give an explicit signal.
On the other hand it's right that on SIGTERM TextEdit won't ask you for saving your half-finished document, it will discard all changes. But that's what I expect if I say 'dear program, please terminate asap'.
Now I think I understand your hint and what it's for, I got it wrong after the first read. But I am still pretty sure that most OS X programs (application or not) do handle SIGTERM and do some clean up before exiting.

Perhaps this example will help further illuminate the matter: I use an application called Journler that updates its internal database as part of its quitting procedure. killall Journler

Companies That Make Apps

kills the app without triggering that procedure.

For further reading, you might be interested in this.

This script was exactly what I was looking for. I am running an iTunes 9 Home Sharing server on an alternate account under Fast User Switching. This is serving the iTunes 'master library' for my family. The iMac it runs on is also a family computer for the kids.
Of course, I frequently need to administer the master library to keep it synced with purchases that have been loaded into individual users' libraries. With this script I'm able to ssh into the iMac FUS account, close down iTunes, then open the same iTunes library on my laptop without interrupting anyone's iMac session.
If the current iMac user is running a second copy of iTunes, this script doesn't seem to see it; it closes down the FUS iTunes session without asking me to choose between the processes. The script does generate a warning message (twice):
_RegisterApplication(), FAILED TO establish the default connection to the WindowServer, _CGSDefaultConnection() is NULL.
but this doesn't seem to interfere with its successful execution.

Just a note that version 1.3 is available.

Usage: quit [-a] [-p] [-s|n] application names

Arguments are the names of one or more applications.
Arguments are not case sensitive.
Arguments with spaces should be quoted.

Options:

App

-a Match argument string with any of the application's name, displayed name, short name, or title. E.g.: `quit 'Microsoft Word'` and `quit -a Word` will both quit Microsoft Word, because the app calls itself 'Word' in the menu bar.

-p Use partial matches (e.g. edit for TextEdit). Prompts for confirmation.

-s Attempt to save modified files when quitting. Overrides any previous -n option.

Resign An Mac Os X App Delete

-n Do not attempt to save modified files when quitting. Overrides any previous -s option.

Phone Shut Down App

If neither the -s or -n options are specified, quit will try to detemine if any documents require saving, and if necessary will ask the user whether to save or not.

Resign An Mac Os X App Cleaner

This script is super useful and helped me schedule cron jobs on a kiosk running Snow Leopard. It was the only thing that would let me automate the closure of an OpenOffice Impress presentation (although I had to execute 'quit' twice while in a full-screen presentation for some reason). On another note, where should I copy custom scripts to so that they can be executed globally? Or how do I modify the included path to include a folder with custom scripts? Thanks!