Disable Automatic Termination of Apps in Mac OS X Lion & Mountain Lion

May 15, 2012 - 22 Comments

Disable Automatic Termination of Apps in Mac OS X

Automatic termination is a feature of OS X Lion and OS X Mountain Lion that comes from the realm of iOS, the idea is that after an app is unused for a period of time and becomes inactive, it will automatically terminate to free up resources for other tasks. With the help of the new auto-save feature, the user should theoretically never notice any of this going on and they can continue on with their work as usual when they need to, letting Mac OS X manage processes and resources for them without quitting apps or manual interaction through Activity Monitor.

For the vast majority of users this is a good thing and most are probably completely unaware of the features existence, but not everyone is thrilled with the prospect of dormant applications being quit without their command and some find it really annoying. If you fall into the second category and want to turn off automatic app termination in OS X, here is how to do it. Don’t worry, we’ll also show you how to turn it back on.

Disable Automatic Termination in Mac OS X
Launch Terminal and enter the following defaults write command:

defaults write -g NSDisableAutomaticTermination -bool yes

Relaunch apps that use auto-termination for changes to take effect.

Re-Enable Automatic App Termination in Mac OS X
You can always reenable the default behavior of OS X and turn auto termination back on:

defaults delete NSDisableAutomaticTermination

Or by reversing “yes” to “no” and running the original command again:

defaults write -g NSDisableAutomaticTermination -bool no

Again, relaunch apps for the changes to take effect and to have auto-terminate enabled again.

This is something that Mac OS X and iOS handles fairly well, and if you’ve never been annoyed by the feature it’s recommended to leave it enabled and let OS X manage tasks itself.

Thanks to qwerty for finding the tip in a StackExchange thread.

Enjoy this tip? Subscribe to the OSXDaily newsletter to get more of our great Apple tips, tricks, and important news delivered to your inbox! Enter your email address below:

Related articles:

Posted by: Paul Horowitz in Mac OS X, Tips & Tricks, Troubleshooting

22 Comments

» Comments RSS Feed

  1. Sam says:

    My experience suggests only Apple apps support automatic termination, I have never seen it outside of TextEdit and Safari.

  2. Romney says:

    Never heard of it. Probably not something to worry about then.

  3. Zav says:

    Yeah, we just published this today. Thanks goes to Lemmy Caution on the Apple Support Communities for the original solution.

  4. Zav says:

    Actually, there is a correction to this article. Here is where Automatic termination rears its ugly head. Create a document in TextEdit, close it and click in the Finder. Command tab back to TextEdit. It’s gone. But it’s not, the GUI is hidden, preventing you from opening an application from the GUI. The app is still running though, but you just can’t get to the GUI. You have to relaunch it.

  5. eturea says:

    Now I understand why my SQLDeveloper (for Oracle) just happend to lose the connections to server. Clearly this is not a good thing for server-client applications. Is there a way to disable this feature only for specific applications?

    • Lemmy/user22760 says:

      Try substituting the “-g” part of the above command with the plist name of the app. Should work. Something like “defaults write com.oracle.sqldeveloper NSDisableAutomaticTermination -bool yes”.

    • Steve says:

      Applications must declare that they support (or don’t) Automatic Termination. It sounds like a bug in Oracle SQLDeveloper that they declare support for it, but don’t actually make it work right.

      I’d file a bug report with Oracle. In the meantime, you can always open the SQLDeveloper Info.plist file and set the Automatic Termination flag to NO (which it sounds like is what Oracle should have done, if they can’t support it right).

  6. Lemmy/user22760 says:

    Be aware that it’s not always enough to relaunch the apps for the command to take effect. Automatic Termination doesn’t actually quit the applications, but sort of ‘hides’ them (just have a look in Activity Monitor, they’re still there). So you must first manually quit them or alternatively just log out and back in again.

  7. vdiv says:

    …and this, Ladies and Gentlemen, is what we call bloatware.

    • Steve says:

      Stopping processes that aren’t doing any work and have no remaining user interface, to clear up memory for apps that you actually are using? This is the exact opposite of bloatware.

  8. Tim says:

    Honestly, are Mac users simply losing brain cells by the minute? I’ve been a Mac person since 1987. Never had a problem with colored icons in the sidebar or keeping track of documents. I know how to manage my own workflows, thank you. It was never that hard to figure out how to get things done. I never met a single person who said, “ya, jeez, I’m constantly forgetting to save changes.”

    So where do the current crop of Apple programmers get their sense of how people operate? Their vision is myopic, to say the least. They have no sense that “manual control” may be necessary?

    As a simple example, I like to use Numbers. Sometimes I need to open a spreadsheet and tinker with some figures, just to see some scenarios for certain data I work with. I have no need, desire, or intention of saving those changes or keeping some archived record of them. I just need a quick look at it all. But the autosave feature – or at least the way it seems to present itself to me – seems to want to remember what I did in spite of it all. I don’t want it to re-open with those changes, and I don’t want to go hunting for the version that should have otherwise gone unchanged in the first place. It slows my workflow considerably. (I eventually reverted to the previous version of iWork that does not have these Lion “benefits.”)

    At the least, why can’t they give us a pref pane to turn these features on and off? Even some of the shareware that tries to solve these “features” is not always successful.

    I stay with Apple out of familiarity and the fact that the competition does not offer me an attractive alternative. But it’s certainly not out of loyalty anymore.

    • Garrett says:

      “At the least, why can’t they give us a pref pane to turn these features on and off?”

      Open System Preferences. Click General. Check the box labeled “Ask to keep changes when closing documents.”

  9. pinta_vodki says:

    Hm, I remember how I thought it would be an annoying function, but actually after I bought Lion I’ve completely forgotten there is this auto termination, only this post reminded me.

    How come you can be annoyed by it? I’ve never noticed any slowing down or anything, even when I’ve run out of RAM. How can one notice that the app has been terminated?

  10. José says:

    Wow!
    What a coincidence! I just started a tread at Apple Support Forums asking for help with an issue that (I think) most likely is related to the discussed here.

    The issue is something that was bothering me and is mentioned here:
    -Quit apps remain working in the background (and) using machine resources.-

    Resources that I bought from Apple (read, the top notch iMac at the store), and from a ram online store (16 GB. The max capacity). Resources that no matter what, Apple is taking the right to decide how much, when and where to use it! :-(

    (I have seen this happening with iCal, Preview, TextEdit, QuickTime)

    My question is:
    Will the command shown above (also) allow me to “terminate” the app process when quitting it?
    If not, Is there a similar command to terminate and app when quit?

    Thank you!

    My (unsolved) thread in Apple Forum: https://discussions.apple.com/message/18411009#18411009
    There is an interesting article from last year here: http://arstechnica.com/apple/2011/07/mac-os-x-10-7/8/

  11. Paul says:

    Is that what’s happening to iTunes?

    I’m streaming a video from iTunes and after 30 minutes the video stop and the machine is logged out.

    Automatic App termination? I don’t know.

    • Kelly says:

      This is EXACTLY why I am searching… and I tried it.. It didn’t work… maybe I’m not doing it right, but it appears pretty straight forward…

      anyone else able to shed some insight?

      • zav says:

        I just set up some new Mountain Lion Macs and made sure to issue the command and can verify that it works.

        Try the commands below one at a time in the Terminal and open TextEdit and close the open document and see if the app still auto quits. Good luck.

        defaults write -g NSDisableAutomaticTermination -bool yes
        defaults write -g NSDisableAutomaticTermination -int 1

  12. CL75 says:

    First, the important details: I’m on Lion 10.7.5, I’ve tried both:

    defaults write -g NSDisableAutomaticTermination -bool yes
    defaults write -g NSDisableAutomaticTermination -int 1

    …I also have both computer sleep and display sleep set to “never” in Energy Saver preferences, the “put hard disk to sleep when possible” box is also unchecked, and yet… after an hour or so of inactivity, Lion quits all applications, logs out, and goes to sleep.

    Now, the rant: This is super annoying for several reasons. For example, I’m trying to update Xcode, which, as we all know is about a 4-5 hour download. Well, Lion shuts itself down, so I can’t update! What, I have to hold Lion’s hand the entire 5 hours? It’s the stupidest thing one can imagine. You would think, at the very least, that the “geniuses” at Apple would have programmed Lion to recognize when an update is taking place and NOT shut down during such a time. But, no.

    Like Tim above and many others, I’ve been getting increasingly frustrated with Apple, ever since Lion.

Leave a Reply

 

Shop for Apple & Mac Deals on Amazon.com

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates