1

I'm on MacOS Sonoma. I have been using Preview extensively for research and had quite a lot of pdf's open (to be able to pick up where I left at later time).

I have set Preview to reopen all previously open documents after being closed, which worked flawless despite it being 10s of pdf's.

Now, due to whatever reason (I think a faulty .jpg caused Preview not to open correctly), Preview has lost my original session and instead only shows some 5 most recent pdfs.

How can I restore the lost session?

I am running a continuous time machine backup, so I hope I will be able to do so.

Using google, I have found a preview container in the library, which contains "Saved application state" with a file for each open window:

/Users/XXXXX/Library/Containers/com.apple.Preview/Data/Library/Saved Application State/com.apple.Preview.savedState

Using time machine, I can see the moment the number of Windows dropped. However, simply restoring the content of this container does not do the trick, preview again only openes those 5 most recent pdfs and alters the content of the container to match 5 windows.

What else do I need to restore? Is there something I have to restore in its entirety?

4
  • There should also be a saved state in ~/Library/Saved Application State/com.apple.Preview.savedState. Maybe it needs both [from the same day]. Not something I've ever tried before.
    – Tetsujin
    Commented Jan 23 at 14:05
  • Appreciated, but I found ~/Library/Saved Application State/com.apple.Preview.savedState to be nothing else than an alias folder linking to the one I posted.
    – Ramschasar
    Commented Jan 25 at 13:38
  • Ah, so it is. Sorry, didn't notice.
    – Tetsujin
    Commented Jan 25 at 13:39
  • I have now restored all of the content of /Users/XXXX/Library/Containers/com.apple.Preview to a previous state, where the savedstate shows the correct amount of window-files, but it did not do the trick and again only opened the most recent 6 files. The list of open documents of the last session have to be stored somewhere else?
    – Ramschasar
    Commented Jan 25 at 16:38

1 Answer 1

1

So I have solved the issue (under Sonoma, as locations might change with newer OS):

As long as you have access to time machine backups, you can indeed restore previous (lost) sessions of preview by simply restoring the content of /Users/XXXXX/Library/Containers/com.apple.Preview/Data/Library/Saved Application State/com.apple.Preview.savedState, which consists of:

  • data.data
  • window_1.data (as many as were open, 1...n)
  • windows.plist

There are no additional files / folders needed.

After this, just start preview and you are back to your old session.

However, keep Your eyes open for corrupt files: In my case, the restore did not work initially (see original post), as the "windows.plist" seemed to have turned corrupt at one point, while time machine kept backing up the full list of window_n.data files. I noticed this, as windows.plist jumped from 70Kb to 4Kb from one day to the next.

If you have access to an old windows.plist file, you can also read out its contents via XCode in plain text, aka a list of open pdfs. Hence, it would be enough to restore this file and take notes on what you were working on.

You must log in to answer this question.

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