Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Disable automatic application termination in OS X System 10.7
If you leave certain applications running without any open windows, OS X will quit the application when it goes to the background. This happens with some Apple apps such as TextEdit and Preview, and perhaps others. There is no user setting to change this in preferences. Here is a Terminal command line to change this feature:

defaults write -g NSDisableAutomaticTermination -bool TRUE

Change “TRUE” to “FALSE” to re-enable it.

[kirkmc adds: What's interesting is when OS X kills an application using this feature, the app still shows up in Activity Monitor. Matt Neuberg has a good overview of this at TidBITS. This has been around since Lion, and I'm surprised there hasn't been a hint yet. The submission specified Mountain Lion, and it's possible that this "feature" is more aggressive in 10.8, but I found mention of this command from before Mountain Lion.]
    •    
  • Currently 3.03 / 5
  You rated: 3 / 5 (39 votes cast)
 
[23,211 views]  

Disable automatic application termination in OS X | 21 comments | Create New Account
Click here to return to the 'Disable automatic application termination in OS X ' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Disable automatic application termination in OS X
Authored by: sduck on Aug 02, '12 08:14:35AM

Are you sure about this? While reading this, I started up some 5 apps, closed all their windows, and switched back to chrome to continue reading and post this. I just checked back, and while they were in the background, they didn't quit or anything. Still there. Haven't done this trick terminal thing in the past or anything like it. Perhaps you mean something different by going to the background? Using mountain lion on a macbook pro here.



[ Reply to This | # ]
Disable automatic application termination in OS X
Authored by: kirkmc on Aug 02, '12 08:39:44AM

It depends on the application. I see it with several Apple apps, notably TextEdit. But I'm not seeing it with others. So it may only be a handful of Apple apps that do this.

---
Mac OS X Hints editor - Macworld senior contributor
http://www.mcelhearn.com



[ Reply to This | # ]
Disable automatic application termination in OS X
Authored by: DavidRavenMoon on Aug 02, '12 08:16:35AM

This is not true of every application. I've been using the Vienna RSS reader, and I close it's single window all the time. It's still in the Dock, and will open a new window when I click on the Dock icon.

Other applications are perfectly happy having no window open when in the background, like Outlook 2011 and even iTunes.

If there a time limit before OS X quits the app?

---
iMac 2.93 GHz Core 2 Duo, 8GB, 1TB, Mac OS X 10.8
www.david-schwab.com
www.myspace/davidschwab
www.sgd-lutherie.com



[ Reply to This | # ]
Disable automatic application termination in OS X
Authored by: astrosmash on Aug 02, '12 09:57:07AM

There is no time limit. The application quits immediately as soon as you switch to a different app. And that's what makes this "Automatic Termination" feature so flawed.



[ Reply to This | # ]
Disable automatic application termination in OS X
Authored by: astrosmash on Aug 02, '12 10:06:47AM

Automatic Termination is deeply flawed in Lion, and is unchanged in Mountain Lion. It's only meant for Windows users who are new to OS X and cannot understand the "Quit" command.

It aims to solve a real problem, but it does so in a very crude way that breaks existing usage patterns. All regular OS X users will definitely want to disable it.



[ Reply to This | # ]
Disable automatic application termination in OS X
Authored by: glusk on Aug 02, '12 09:38:32PM

Not sure about "flawed" but things sure changed in Lion. The apps that I have noticed auto-closing also save their state. So instead of CMD-Q to quit an app and close all windows, I have to CMD-W or OPT-CMD-W to close the windows that are open so that they don't re-open when the app is launched later. But I don't have to CMD-Q because the app will then quit itself.

I think this needs a lot of work as it's taking me a very long time to get used to and it's inconsistent across apps. Even if it were consistent, I'm not sure I'd like it. But it seems to be the new way. :-(



[ Reply to This | # ]
Disable automatic application termination in OS X
Authored by: auco on Aug 02, '12 10:19:52AM
This hint mixes two things with little knowledge and some false information.

1. There is termination after the last window has been closed.
There is a setting in NSApplication which every application can opt in:
 -(BOOL)applicationShouldTerminateAfterLastWindowClosed:
If the developer sets this to true, it'll quit after the last window has been closed. The default state on Lion is to not quit. Maybe this has changed with Mountain Lion, but I don't think so. You cannot alter this behavior as user.

2. Automatic Termination:
Since Lion there is automatic termination and it has absolutely nothing to do with closed windows or not (or very little). On Lion this has been totally in the background and on Mountain Lion it's simply taken to the UI. This is a concept originating from iOS and it terminates applications automatically based on a well defined rule set, e.g. inactive time, idle state, frequent activation, amongst others... So, to the end user it doesn't really matter if the app is running or not, that's why the active item indicator in the dock shrunk (and it'll probably disappear completely with 10.9.)
It's like on iOS. There is the last used app icon, but as a user, you can't say if it's still active or inactive but just recently used.

Edited on Aug 02, '12 10:22:52AM by auco


[ Reply to This | # ]
Disable automatic application termination in OS X
Authored by: vykor on Aug 02, '12 12:15:02PM

Well, perhaps not quite. There is a system policy to "terminate" apps with no windows open, automatically -- this has been set since Lion, and has nothing to do with the app-specific setting. You can see John Siracusa's review on it from Ars.

http://arstechnica.com/apple/2012/07/os-x-10-8/18/#automatic-termination

You can test this experimentally by opening Preview, opening a PDF, closing the window, and then switching to another app. Preview disappears from the Dock and the Cmd-Tab list.

Now, the process does not actually leave the Activity Monitor or top, so one wonders how "terminated" it really is.



[ Reply to This | # ]
Disable automatic application termination in OS X
Authored by: chabig on Aug 02, '12 02:32:56PM

"You can test this experimentally by opening Preview, opening a PDF, closing the window, and then switching to another app. Preview disappears from the Dock and the Cmd-Tab list."

On my machine, Preview stays in the Dock and the Cmd-Tab list. I think the System is smarter than you think and is basing the decision to terminate or keep open based on demand for resources.



[ Reply to This | # ]
Disable automatic application termination in OS X
Authored by: DavidRavenMoon on Aug 03, '12 08:08:21AM

So I just tried opening Preview, and then opening a PDF. As soon as I closed the PDF window Preview did quit, and it is still in the Activity Monitor.

Very odd.

---
iMac 2.93 GHz Core 2 Duo, 8GB, 1TB, Mac OS X 10.8
www.david-schwab.com
www.myspace/davidschwab
www.sgd-lutherie.com



[ Reply to This | # ]
Disable automatic application termination in OS X
Authored by: jaydisc on Aug 02, '12 05:02:45PM

I think you still have to opt-in for this behavior. Obviously, Apple has opted-in Preview and TextEdit.



[ Reply to This | # ]
Disable automatic application termination in OS X
Authored by: interlard on Aug 02, '12 11:00:37AM

This automatic termination always caused Preview to crash when I left it in the background on Lion. I'm thrilled I can now stop this annoying, nannying behavior.



[ Reply to This | # ]
Disable automatic application termination in OS X
Authored by: philostein on Aug 02, '12 02:05:57PM

I haven't used this hint, and I'm running ML on my 2011 MacBook Air.

For over an hour, Preview and TextEdit have been running with no open windows.

The apps are still in the application switcher. What gives?



[ Reply to This | # ]
Disable automatic application termination in OS X
Authored by: outer on Aug 02, '12 02:18:49PM

An interesting side effect of this user-friendly behaviour is that (at least under Lion 10.7.4) it is impossible to Empty Trash of a document that was opened with an automatically terminated application (for example, Preview). I find I have to manually launch Preview and then manually quit Preview before I can empty the trash of a document that had been opened with the automatically terminated Preview. So very user-friendly! Such a coherent user experience!



[ Reply to This | # ]
Disable automatic application termination in OS X
Authored by: scottbayes on Aug 02, '12 05:06:33PM

<<An interesting side effect of this user-friendly behaviour is that (at least under Lion 10.7.4) it is impossible to Empty Trash of a document that was opened with an automatically terminated application (for example, Preview). I find I have to manually launch Preview and then manually quit Preview before I can empty the trash of a document that had been opened with the automatically terminated Preview. So very user-friendly! Such a coherent user experience!>>

Might be because it uses lock files and hasn't closed them at automatic termination in order to be "user-friendly" and restore the app to it previous state when it opens again. Starting the app and quitting it would remove the lock file.

One step forward, two back, the usual since Lion.



[ Reply to This | # ]
Disable automatic application termination in OS X
Authored by: blueatria on Aug 02, '12 10:55:02PM

I am not sure I believe it as simple as people are saying here. I have preview and textedit open most of the time with no windows open of either and use other applications and never see them terminated (or any other application for that matter) unless I quit them myself. Surely the automatic termination would take into account available system resources. I have a retina mbp with 16gb of ram running 10.8 so maybe there is no real contention for resources on my machine. Why would you automatically terminate a application if there is no contention for resource? Just my 2c.



[ Reply to This | # ]
Disable automatic application termination in OS X
Authored by: Lri on Aug 03, '12 06:28:47AM

I tested the setting on 10.7 and it worked with at least TextEdit. It was mentioned in this answer at Ask Different in May.

If anyone is testing the setting, you have to quit and reopen applications once for it to take effect. Normally if you closed all windows in TextEdit and focused another application, TextEdit would be hidden from the Dock and application switcher immediately. NSDisableAutomaticTermination should prevent that.



[ Reply to This | # ]
Disable automatic application termination in OS X
Authored by: sojourner on Aug 14, '12 09:46:44AM

Most odd. I'm running 10.7.4, and I've never had apps automatically terminate. When I type defaults read -g NSDisableAutomaticTermination in Terminal, I'm told it does not exist.



[ Reply to This | # ]
Disable automatic application termination in OS X
Authored by: aGr[j5(6WU on Aug 14, '12 10:55:11AM

The official Twitter app from the Mac App Store auto-terminates after a period of time if you close the main window. What's weird about that is that:
a) leaving it open in the background is necessary to receive tweets as they're sent
b) it has a menubar item
I think I also read that this app triggers the discrete GPU on MacBook Pros even though there's no need, so perhaps it's just a poorly-coded app.



[ Reply to This | # ]
Disable automatic application termination in OS X
Authored by: RussellK on Aug 15, '12 07:51:19AM

When I first noticed this with some apps, I thought the apps were somehow crashing in the background without generating any error/crash reports onscreen...so was somewhat relieved to read that this is actually intended behavior.

Just a thought...but if having the apps in question auto-terminate is a problem, has anyone considered hiding the apps (instead of closing their main windows) when they're not in use? That's what I've been doing, and it seems to work well...



[ Reply to This | # ]
Disable automatic application termination in OS X
Authored by: BlackjackJoe on May 02, '13 02:48:04PM

I've seen this a lot with Apple's Calendar App, but when my coworker tries it, he doesn't see the auto terminate. There's has to be something more subtle than just closing windows to trigger this.



[ Reply to This | # ]