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:
- Have two image files on your desktop.
- Double-click the first file to see it open in Preview, then quit Preview.
- 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:
- Click Applications.
- Scroll down and click the Utilities folder.
- 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:
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:
- Open your file.
- Use [Command][W] to close the file.
- 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.