When some apps like Preview and TextEdit are left in the background without any windows open, they just quit, don’t they?
Although they might look like they do, and they vanish from the Dock, they haven’t quit at all. They’re actually still running, just taking a nap. Switch back to them and they’ll fire up instantly, ready to open their next document. So how come they remove themselves from the Dock, and App Switcher, as if they have quit? And why do other Apple apps like Pages and Numbers now do the same?
States of apps
Go back a few years, and apps with visible interfaces (rather than daemons and other background services) had two basic states: running, and not running. Then Apple introduced App Nap, which apps can enter when they are completely idle, and you’re not interacting with them.
macOS uses a set of rules to determine whether an app gets to nap. This becomes most likely when:
- The app is in the background, with any open windows not at the front.
- The app hasn’t updated any visible portion of any open windows for some time.
- The app isn’t playing any audio.
- The app isn’t using OpenGL graphics.
- The app hasn’t told macOS that it is still active (by taking IOKit power management or NSProcessInfo assertions).
All apps are now eligible to be put into App Nap, and there’s no user setting which you can use to prevent this from happening, neither is it something that the app developer has to enable: it is determined by macOS.
In normal App Nap, the app’s windows remain open, its icon in the Dock still has the small black dot below it to indicate that it is running, and you can switch to it using the App Switcher, shown by pressing and holding Command-Tab. You can tell which apps are napping by opening Activity Monitor, showing the App Nap column in its process display, and sorting by that column.
With few apps running, the only processes likely to be caught napping are Spotlight, and the PressAndHold support service.
Enter the zombie app
More recently, Apple’s apps have started to behave differently. Support tools like TextEdit and Preview enter this instead of quitting automatically, when they go into App Nap without an open document. You can observe this by starting them up and leaving then to go into the background without any open documents.
With a longer list of apps open and in the background, most of them now go into App Nap, as shown in Activity Monitor.
Bring up the Force Quit dialog using Command-Option-Escape, and you’ll see that they are still listed there as running.
Look at their icons in the Dock, though, and the normal black dot has vanished, as if the app has actually quit.
They’re also missing from the list of open apps in the App Switcher (Command-Tab).
Apps which now behave like this include the current versions of Spotlight, Pages, Numbers, Preview, TextEdit, and Xcode. Apple apps which don’t normally do this even though they enter App Nap include Mail and Safari, and (as far as I can tell) all third-party apps.
A fourth state
macOS has therefore gone from having two basic states for apps, to four:
- Running and not napping,
- Running, in App Nap, and still fully accessible,
- Running, in App Nap, and hidden – a zombie,
- Not running at all.
Apple hasn’t coined a term which we can use to describe its apps which are in App Nap and hidden, nor has it come up with an appropriate human interface with which to interact with them. For example, if you want to quit one of these zombie apps, you have to ‘open’ it again (although as I have shown it is still actually open and running), and use its quit command. Only then will it be removed from the list of processes in App Nap.
There doesn’t seem to be any way to prevent Apple’s apps from entering this zombie state, either. It doesn’t appear to be determined by dictionary entries in the Info.plist file or preference settings for the app, and in any case, as these apps are often protected by SIP, only their preferences are editable by the user. We can only hope that Apple comes up with a better human interface for their control, rather than showing the signs as if they have quit, when they haven’t.