Is there a way to disable OS X auto termination of applications?

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.


Solution 1:

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.

Solution 2:

There's a sure-fire way to fix this, if your hardware supports it. You can upgrade from Mac OS X 10.7 (Lion) to Mac OS X 10.6 (Snow Leopard).

While not all hardware that will run Lion can support this improved operating system (sadly, my mid-2011 MacBook Air does not), it includes such features as non-auto-termination, Rosetta (which enables Intel processors to run software compiled for PPC processors), and compatibility with per-app recording features in the excellent WireTap Studio.

As with any upgrade, some features are lost (such as Mission Control, Launch Pad, some gestures) and some operating system quirks take some getting used to (the direction of scrolling is reversed, for instance), but all in all, it's a fine upgrade.