When do some apps (like preview) auto close when I stop giving them focus? Whats the difference between those and others that don't close?



Quoting from this typically comprehensive Ars Technica article: http://arstechnica.com/apple/2011/07/mac-os-x-10-7/8/

Lion will quit your running applications behind your back if it decides it needs the resources, and if you don't appear to be using them. The heuristic for determining whether an application is "in use" is very conservative: it must not be the active application, it must have no visible, non-minimized windows—and, of course, it must explicitly support Automatic Termination.

Automatic Termination works hand-in-hand with autosave. Any application that supports Automatic Termination should also support autosave and document restore. Since only applications with no visible windows are eligible for Automatic Termination, and since by default the Dock does not indicate whether or not an application is running, the user might not even notice when an application is automatically terminated by the system. No dialog boxes will ask about unsaved changes, and when the user clicks on the application in the Dock to reactivate it, it should relaunch and appear exactly as it did before it was terminated.


Applications like Preview support automatic termination.

If for example you open Preview, open at least one window in it, close all windows, and focus another application, Preview is hidden from the Dock and the application switcher. The process is not actually terminated, but there might be some changes in how it is managed.

I don't know if there are some situations where processes that support automatic termination are actually terminated, but things might change in future versions of OS X. The Mac App Programming Guide does say that programs are actually terminated:

Automatic termination eliminates the need for users to quit an app. Instead, the system manages app termination transparently behind the scenes, terminating apps that are not in use to reclaim needed resources such as memory.

You can disable automatic termination (or automatic hiding from the Dock and the applications switcher) by enabling NSDisableAutomaticTermination:

defaults write -g NSDisableAutomaticTermination -bool true

You must log in to answer this question.

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