MacOS – way to disable OS X auto termination of applications

applicationsmacmacos

Is there a way to tell OS X Lion to disable auto-termination for a given application that you do not want to auto terminate?

FYI Lion is a quitter if you did not already know, what if you don't want it to be for a certain Applicaiton.

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.

For example, say I don't want TextEdit to automatically quit when I have no TextEdit windows open and switch to another Application.

After taking a look at Mac App Programming Guide section for Automatic Termination I figured I would try adding the NSSupportsAutomaticTermination key with the value of No to the Info.plist file for TextEdit. (Did not work: TextEdit crashes on open.)

To be noted, the file did not include NSSupportsAutomaticTermination key (which means that Apple was using NSProcessInfo to enable auto termination), so adding a key would probably have no effect anyways since NSProcessInfo overrides what is in the plist file. (Verified this does not work, by self-signing TextEdit with a modified Info.plist including the NSSupportsAutomaticTermination key and value of No).

One side effect noted is that changing anything in the Info.plist file causes TextEdit to crash when opening. The cause is noted from the crash log as "code signature invalid", which means that the TextEdit app and all its contents are code signed. The workaround is to self-sign the app using the codesign command and a self-signed root certificate as noted in Code Signing task.

After what I have tried so far, TextEdit still obeys Automatic Termination.

Best Answer

Your wish is my Terminal command ;-)

defaults write -g NSDisableAutomaticTermination -bool yes

Note that since Automatic Termination doesn't really quit the applications, but rather hides them, they must have been properly quit for this to take effect.