Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

In Lion, I've had an incredible amount of difficult with Preview hanging indefinitely when restoring open documents after being hidden for any extended period of time.

There is no immediate solution except to force quit Preview and relaunch it. Console reports no error messages except for Preview being manually killed.

Any recommendations on dealing with this problem?

share|improve this question
1  
I've had this problem too, especially in 10.7.0 and 10.7.1 - it seems to be something to do with the new way Lion automatically quits and reopens apps without you knowing it to free up memory. 10.7.2 has been much better, but I still occasionally have it happen. –  glenstorey Nov 28 '11 at 22:23
add comment

1 Answer 1

up vote 4 down vote accepted

I’ve been having this problem in Lion, and the only workaround I’ve found is to disable Resume, on a once-off or total basis for Preview.


Disabling Resume permanently

If you open Terminal (/Applications/Utilities/Terminal.app), and enter the following string, then Resume for Preview will be disabled permanently:

defaults write com.apple.Preview NSQuitAlwaysKeepsWindows -bool false

You can also disable Resume for all apps in System Preferences: in the General pane, untick the checkbox marked Restore windows when opening and quitting apps. I find Resume generally useful, so I haven’t, but you might want to do this.


One-off disabling or Resume

If you don’t switch it off permanently, and you’re working with a lot of files in Preview, you might not want it to re-open them the next time you launch it. When you quit Preview, hold down the option key; then the Quit Preview command becomes Quit and Discard Windows. Use this, and it won’t reopen all of your files next time. (Keyboard shortcut is opt-cmd-Q).

If you forget to do this when you close Preview, and it starts hanging, then you can flush the Resume data. Navigate to ~/Library/Saved Application State/com.apple.Preview.savedState and delete the file or folder stored there. This deletes all the saved data for Preview, so when you open Preview later, it doesn’t restore any of your saved documents.

This is probably more useful if it’s misbehaving intermittently, than for the problem you describe.


Further comments

  • If you’ve set Preview to never remember your files, you can temporarily get it to remember them. As with the one-off disable, hold down the option key when you quit Preview, then you get the command Quit and Keep Windows.

  • I disabled Resume for Preview shortly after Lion came out, and I’ve not had any problems since. However, I only use Preview for images, not PDFs (I use TeXShop for that), but even so, the hanging is completely gone.

  • You can also have “opt-in” Resume using these steps. If you disable Resume for all apps, then run the Terminal command above with true instead of false, then you can whitelist Resume-enabled apps, rather than blacklist them. You can find the com.apple.Preview equivalent for any app by looking at what the appropriate file is called in the Saved Application State folder. (A quick Google search for Terminal commands involving that app would also do the trick).

I hope some of this is useful and speeds up Preview: it certainly worked for me.

share|improve this answer
    
Alex, great answer. You should edit this answer and check it as community Wiki. That'll help future readers who stumbled on this. Thanks. –  Global nomad Dec 3 '11 at 14:10
    
I've noticed that Preview often resumes correctly when not trying to open another document. Anyone tried creating a tool to block open document messages to Preview until the activation message has completed? –  Jeff Burdges Dec 26 '11 at 16:53
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.