Mac OS X Lion - Preview reopens all previous documents (Preview history feature)

I upgraded one of my computers to Mac OS X Lion recently, and because I'm working with images a lot right now, I quickly ran into a weird quirk: The Preview app on Lion reopens all your previous documents whenever you start it.

If you haven't seen it before, here's how this Lion Preview history feature works:

  1. Have two image files on your desktop.
  2. Double-click the first file to see it open in Preview, then quit Preview.
  3. Double-click the second image file. Preview opens not only this file, but the first file as well(!).

Fixing this Preview "history" problem

To fix this problem, and get Preview to work the "normal" way -- the way it used to work -- you have to crack open the Mac OS X Terminal application. As a quick warning, if you're not comfortable with Unix and command-line systems (like DOS), you may want someone else to do this.

Unless you've customized your system, you can open the Mac Terminal application like this:

  1. Click Applications.
  2. Scroll down and click the Utilities folder.
  3. Click the Terminal application.

This will open a Unix terminal window. All you have to do here is type this one command:

defaults write com.apple.Preview NSQuitAlwaysKeepsWindows -bool false

It's probably best to just copy that command, then paste it into your Terminal window, then hit [Enter] at the end of the command.

When you do this, you shouldn't see any sort of reply on the command line. That's the way Unix works: If your command is a success, you won't see anything but another prompt. Conversely, if there is a problem, you will see some sort of error message.

Here's what this Terminal view looks like on my system, with the caveat that I use Terminal all the time, so I've customized my colors and fonts:

Mac OS X Lion Preview reopens all files - Mac defaults write command

Once you've issued this command successfully, you can try that test with the two images again, and you should see Preview work normally again, opening only the file you want to open, instead of opening your entire history of files.

Another workaround to the Lion Preview history problem

As I wrote in an earlier article, I think the Windows Vista guy designed Mac OS X Lion, another workaround to the Mac Lion Preview history problem is to use two commands to close your image files, first [Command][W] and then [Command][Q]. The first command there means "close the current file", and the second command means "quit this application", so this has the net effect of telling Preview to first close the file, which means it won't later reopen the file when you open another image file.

To summarize, this workflow is:

  1. Open your file.
  2. Use [Command][W] to close the file.
  3. Use [Command][Q] to quit Preview.

As mentioned, I don't care for this approach, but unless you're willing to crack open the Terminal application and type that "defaults write" command, it's the only other thing I can suggest.

Mac OS X "defaults write" commands

I lived with this approach for about ten days, when I finally decided it was pretty ridiculous, and fortunately I was able to find the "defaults write" command above. I've known for years that defaults commands like these were available on Mac OS X, but I've never had to use one for now. At some point I'll document other defaults commands you can run, but for today, I just wanted to handle this Lion Preview "reopen previous documents" problem.

programs reopening all previously open documents under OS X Lion

Thanks so much for providing this fix via Terminal for this terrible behavior that Apple has introduced into its programs (Preview, Safari, maybe others) in which all previously open documents are automatically reopened. I too see a deterioration in the quality of the interface of OS X, and this problem was a glaring example.

Thanks again!

Reopening Previous Documents

I am not bothered by you call a 'weird quirk' and 'problem' - it's feature that I rather like (particularly for Safari). I think whether you dislike it (like you do) or like it (like I do) comes down to preference, and perhaps there should be an easy option within Preferences rather than using Terminal to change this.

Restore makes sense for Safari

I agree that Restore can make sense for Safari; I use that feature all the time in Chrome and Firefox.
But for me it doesn't make sense in most other apps, including Preview, Pages, Terminal, and TextEdit. Those are the other apps I've disabled so far. In those apps my only interest is to double-click a file to open it. Opening everything else don't make sense, at least not for me.

OS X Lion Restore preference

Thanks to someone who commented on another article I wrote on this issue, I found that there is a Restore setting in System Preferences. Just go to System Preferences -> General -> "Restore windows when quitting and re-opening apps." Unfortunately that's a global setting, and it whacks Safari's Restore capability as well.

Thanks for solution to Preview - Lion problem.

Your cure for Preview on Lion worked great. This was driving me nuts and taking mucho time.

Post new comment

The content of this field is kept private and will not be shown publicly.