Simon Willison’s Weblog

Subscribe

Is it possible to restore an older version of a Pages doc without using Pages?

17th December 2012

My answer to Is it possible to restore an older version of a Pages doc without using Pages? on Quora

We recovered it!

It turns out Pages (and other OS X apps that track versions) saves copies of the file automatically in the /.DocumentRevisions-V100/ folder on the root of the hard drive.

We recovered the most recent non-corrupt version of the file from there using the command line.

Step one: switch to a root prompt:

$ sudo su
<enter account password>

Step two: List all of the files in that folder with their modified date, to make it easy to spot likely candidates (since the filenames themselves are meaningless):
$ ls -lah /.DocumentRevisions-V100/PerUID/501/*/*

Hopefully there will be something a bit like this that matches your expected last modified date for the document:
/.DocumentRevisions-V100/PerUID/501/5d/com.apple.documentVersions:
total 0
drwxr-xr-x 6 root wheel 204B 11 Dec 20:35 .
drwxr-xr-x 3 root wheel 102B 11 Dec 20:29 ..
-r--r--r--@ 1 simon staff 261K 11 Dec 20:35 C02D5229-7972-4618-9288-90A9FEEAD44C.pages

Step three: copy the file to your desktop:
$ cp /.DocumentRevisions-V100/PerUID/501/5d/com.apple.documentVersions/C02D5229-7972-4618-9288-90A9FEEAD44C.pages /Users/simon/Desktop/

If you’re lucky, the recovered file will open just fine (you can then save a duplicate and continue working with it).