2

I am currently operating with Monterey, 12.6.5. I routinely keep 20+ documents open in Preview. Whenever Preview quits, whether it is for a restart, an intentional quit, a crash, or a forced quit, it reopens with a different set of documents than were open when it quit. I can't tell when this list of 'active documents' was set – it seems like a random group of docs that were open sometime between the prior launch and the recent quit.

This didn't always happen with Preview, but it has been happening since at least version 11, Big Sur, and it feels like earlier than that. I have tried debugging this several times, with no luck. I long ago unchecked the option System Preferences → General → Close windows when quitting an app . That hasn’t done anything.

I also boosted the System Preferences → General → Recent Items list to 30, and it did nothing. This didn't seem to be a limiting factor anyway; my last setting was 10 and Preview would reopen with more than 20 documents open at a time – just not the ones open on the last quit.

Any ideas on how to address this? It's not the end of the world, but I use Preview to review and notate papers as I write my own work, and the active open list is helpful. Not infrequently, I'll have changes that were not saved in one or more of the open documents. While that's clearly on me, it just adds to my frustration. I don't think it's related to the problem, but offer it in case it might be.

4
  • Maybe try to enable "Close windows when quitting an app". Tell me id it worked or not.
    – Thinkr
    May 12, 2023 at 14:32
  • Is Preview (re)opening with documents previously closed (unopened) from the last session?
    – Allan
    May 12, 2023 at 14:44
  • Thinkr: sorry, but I didn't try this first.
    – D14723
    May 12, 2023 at 20:03
  • @Allan, no it was some weird combination of files. Some were files that opened the last time but I had closed since. I started having this problem over a year ago, so I've been trying to not restart Preview since. I tried to debug the list when it first started and it ended up that it wasn't as simple as some subset of the last session's files.
    – D14723
    May 12, 2023 at 20:06

1 Answer 1

1

Launch Preview, then use Finder's Go menu to see its saved state
Go > Go to Folder > ~/Library/Saved Application State/com.apple.Preview.savedState
This should be an alias folder with a little arrow bottom left enter image description here, the real folder is in
~/Library/Containers/com.apple.Preview/Data/Library/Saved Application State/com.apple.Preview.savedState
Use Show Original or just Go > Go to Folder again, so you can see both at once.

If nothing else, this will establish if the alias is still linked to the correct place.

Then Quit preview.
Does this set of files stay in place, or is it deleted as Preview Quits?

If it is not deleted, then just this once, delete the savedState folder contents. Try again - launch, open a pdf or two, Quit, launch.

If it is deleted, then we need Terminal

defaults read com.apple.Preview NSQuitAlwaysKeepsWindows
If the result is 0 then defaults write com.apple.Preview NSQuitAlwaysKeepsWindows -bool true
you can test again with the first command. The result should be 1.

This should change the behaviour to not delete the folder contents at Quit.

You can use this NSQuitAlwaysKeepsWindows parameter to selectively switch on & off any individual application's saved state status, just using the app's URI com.company.appname

5
  • This definitely fixed it. I did have to delete these files first. Once I did that, it worked perfectly. I did notice that after I deleted the files and restarted, they obviously were added again. However, when I quit again, they did not disapear when I quit the next time. I'm guessing that's the way it should go, but wondering how it relates to the original problem and the solution.
    – D14723
    May 12, 2023 at 20:02
  • All I can guess is that something got 'stuck'. Deleting manually just 'unstuck' it. All the terminal stuff was just in case it had been switched off & you'd forgotten (I've done that before;) The correct behaviour is that it doesn't delete them - but the contents are constantly changed. If something got stuck it may have been using files that were out of sync with the actual last state.
    – Tetsujin
    May 13, 2023 at 6:23
  • I'm having the same problem than OP and this didn't fix it.
    – memeplex
    Jan 29 at 13:13
  • Then raise it as a new question, linked back to this one, with sufficient detail to try formulate a different course of action.
    – Tetsujin
    Jan 29 at 13:29
  • I solved it removing the preferences plist from the container, but I had to restart the system after that because otherwise Preview kept restoring it somehow, as if it had not really quitted.
    – memeplex
    Jan 29 at 15:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .