Skip to content
Thoughtful, detailed coverage of everything Apple for 28 years
and the TidBITS Content Network for Apple professionals
16 comments

Lion Zombie Document Mystery Solved

Although I’m the author of “Take Control of Using Lion,” I don’t actually like Mac OS X 10.7 Lion very much; the book doesn’t express my biases explicitly, but you can sense them clearly enough if you read attentively. And one of the Lion features I dislike the most is Resume, which I privately think of as “Zombies.” Resume comes in two parts:

  • When you start up the computer, Lion wants to launch all the applications that were running just before you previously shut it down. The same applies, obviously, to restarting, or logging out and logging back in.

  • When you launch an application, Lion wants to open all the same documents and windows that were open in that application when you previously terminated it.

I don’t like these behaviors because, to me, they fly directly in the face of precisely what restarting the computer or quitting an application is for. I like to quit an application exactly as a way of making that application close all its windows and forget about all its open documents. I like to restart the computer (very frequently) as a way of blowing out all the cobwebs, clearing memory, and putting the computer into a fresh state, with no applications running. I don’t want applications launching themselves automatically (aside from the few utilities that I’ve designated as Login Items in the Users & Groups preference pane), and I certainly don’t want applications that are launched to reopen a bunch of stale windows and documents from the past.

In my book, I also explain how to take control of these features — which in my case means turning them off. When I restart the computer or launch an application, I want a clean slate, every time. Here’s how I get it:

  • To prevent applications from relaunching at system startup time, you have to take preventative measures at shutdown time: in the dialog that appears when you shut down or restart or log out, uncheck the checkbox that says “Reopen windows when logging back in.” Of course, this means you have to avoid situations where that dialog doesn’t appear — especially because, until the recently released 10.7.4 update, Lion would check that checkbox by default even if you had previously unchecked it. But, thanks to that update, the checkbox is now staying unchecked; I suppose I should be grateful to Apple for small favors.

  • To prevent windows from bringing their documents and windows back from the dead at launch time, uncheck “Restore windows when quitting and re-opening apps” in the General preference pane. (That hyphen is Apple’s mistake, not mine: Apple really does write “reopen” in one place and “re-opening” in another.) It’s possible, instead, to use a third-party utility such as TinkerTool to turn off this behavior for individual applications, as I explained in “Lion Frustrations? Don’t Forget TinkerTool” (29 October 2011), but I prefer to turn off this feature globally.


However, there’s a mystery. Even though I’ve unchecked “Restore windows when quitting and re-opening apps”, some applications still sometimes bring their zombie windows back from the dead when I launch them. Until recently, I hadn’t paid much attention to this mystery; I tended to shrug it off as more of Lion’s inscrutable annoyance. After all, coming back from the dead is what zombies do, so it didn’t surprise me that a few of them wouldn’t stay dead. I just sighed and closed the spontaneous windows by hand.

At the same time, though, it irked me that, while I was supposed to be telling readers how to take control of Lion, I still couldn’t seem to get full control of Lion myself. I mean, Lion has been around for a year, and I still don’t have these issues straightened out? Shameful.

A few days ago, though, I suddenly thought I’d detected a pattern. I made a few tests, and sure enough, there it was: the mystery was solved.

I know you’re right on the edge of your seat, so I won’t keep you in suspense. Here’s the answer: If an application is running at the time you shut down the computer (or restart or log out), that application will reopen its zombie windows the next time it is launched, even if you have told it not to.

As soon as I’d noticed this pattern, I also understood the reason behind it. In Lion, there’s more than one way of quitting an application. When you quit an application (by choosing Quit [ApplicationName] from the [ApplicationName] menu, or pressing Command-Q), the application shuts down in good order, and your preferences with regard to zombie windows are enforced. But when Lion quits an application (because you’ve told the computer to restart or shut down while the application is running), it takes a completely different approach. It reasons that we need to get the heck out of here as quickly as possible, so it uses a new-in-Lion protocol called Sudden Termination (if the application in question supports it).

The purpose of Sudden Termination is to support Resume (wouldn’t you know it?); most applications (perhaps all) that support Resume also support Sudden Termination, and it’s here that the trouble lies.

The idea is that, as in iOS, a Sudden Termination–enabled application constantly saves its state, including what windows are currently open. That way, the application can be terminated quickly, because it has no work to do at termination time; all the work has already been done. Under Sudden Termination, the application is never even told that it is being terminated! (In technical terms, it is never sent a Quit event.) Instead, the system simply pulls the plug; in effect, it simply and summarily clears the application from memory and rips it off the screen.

Do you see where this is going? Because the application is instantly blown away, it never has a chance to perform any tasks associated with quitting. In particular, it never has a chance to obey your dictates with regard to Resume! The application has been saving state all along, and now, when the application is sudden-terminated by Lion’s restart or shutdown process, that state is simply left in place — where the system finds it the next time the application is launched, resulting in zombie windows coming back from the dead.

Naturally, I regard this as a bug. But it isn’t a bug I expect Apple to fix any time soon (or ever), because it’s rooted in the new Lion philosophy of making the desktop more like an iOS device. Reading the developer documentation, you can actually witness Apple persuading programmers that Sudden Termination is a good thing, “designed to improve the user experience.” (You also discover that it is of a piece with Automatic Termination, which I complained about in “Lion Is a Quitter,” 5 August 2011.) Fortunately, until Apple fixes this problem (which will presumably be never), there’s an easy, though tedious workaround. Before I restart or shut down my computer, I quit every application. Slowly. Deliberately. Manually. Myself. One. By. One.

Subscribe today so you don’t miss any TidBITS articles!

Every week you’ll get tech tips, in-depth reviews, and insightful news analysis for discerning Apple users. For 28 years, we’ve published professional, member-supported tech journalism that makes you smarter.

Registration confirmation will be emailed to you.

Comments About Lion Zombie Document Mystery Solved