BASALT · JOURNAL
How to recover a previous version of a PDF on a Mac
To restore a previous version of a PDF on a Mac, open it in Preview and choose File > Revert To > Browse All Versions. Move back through the saved versions, then click Restore to replace the current file, or hold Option and click Restore a Copy to keep both. If Versions has nothing useful, Time Machine is the next place to look.
The third place is the file itself. Some PDFs carry their own earlier saves inside them, because certain programs add changes to the end instead of rewriting everything. That makes recovery possible without any backup, and it's also why a file you thought you'd cleaned can still hold what you removed.
Option one: macOS Versions in Preview
Versions is a macOS feature, not a PDF one. Apple's Mac Help says "many apps automatically save versions of documents as you work on them," and that "a version is saved automatically every hour, or more frequently when you're making many changes." It adds that a version is also saved when you open, save, duplicate, lock, rename or revert a document. Apple's page doesn't list which apps support it, but Apple's Preview guide describes the steps for Preview.
The steps in Apple's Preview guide:
- Open the PDF in Preview.
- Choose File > Revert To > Browse All Versions.
- Click the arrows beside the previous versions, or click a tick mark on the timeline on the right.
- When you find the one you want, click Restore. To make a new file from that version instead, hold down Option and click Restore a Copy.
- Click Done to leave without reverting.
If you only need a recent point, File > Revert To also offers Previous Save, Last Saved and Last Opened, each with a date and time. Using Restore a Copy is the safer habit, because it keeps the current file as it is while you look at the older one.
Versions holds only what this Mac recorded for that file. A PDF you received and never changed has nothing older to show.
Option two: Time Machine
If you use Time Machine, an older copy of the file may be in a backup. Apple's steps for restoring an item are:
- Open a window for the folder where the file was, such as Documents. If it was on the desktop, you don't need to open a window.
- Use Spotlight to open Time Machine, which is in the Other folder.
- Use the arrows next to the Finder windows, or the timeline on the right, to move through your backups.
- Select the file and click Restore. It returns to its original location.
Apple's page also notes that for an earlier version of a document you can open the app and choose File > Revert To > Browse All Versions, if the app supports it. Restoring puts the item back where it was, so if you want to compare it first, copy the current file to another name before you restore.
A backup has only what existed when it ran, so a state that came and went between two backups isn't in any of them.
Option three: earlier saves inside the PDF itself
A PDF can be saved in two ways. One rewrites the whole file. The other is an incremental update: the program appends the changes after the old content, adds a new cross-reference section and a trailer whose /Prev entry points back to the old one. The old bytes stay in the file. Digital signatures rely on this design.
Each save ends with an end-of-file marker, %%EOF, so counting those markers suggests how many generations the file holds. These two commands only read the file:
grep -a -c '%%EOF' document.pdf
grep -abo '%%EOF' document.pdf
The first prints the count. The second prints each marker's byte offset, such as 754:%%EOF and 1167:%%EOF. Keep the -a: without it, macOS's grep treats a PDF as binary and prints "Binary file document.pdf matches" instead of the offsets.
To get the earlier version, write a new file that stops at an earlier marker. The offset plus 5 is the number of bytes to keep, because %%EOF is five characters long. With a first marker at offset 754:
head -c 759 document.pdf > earlier.pdf
qpdf --check earlier.pdf
The copy earlier.pdf holds the file as it was at the first save, and qpdf --check (from brew install qpdf) confirms it parses. On macOS 15, a sample file with one incremental edit showed the edited page text in the original and the earlier page text in the cut copy, and qpdf found no errors. Check the cut by opening it in Preview. Never write the result over document.pdf; use a new name every time.
When the in-file method doesn't work
It works only when the file was saved incrementally. Three cases to know:
- The file was rewritten in full. A program that saves everything fresh leaves one marker and nothing earlier. On macOS 15, a file re-saved through PDFKit, the macOS PDF framework, came back with a single
%%EOF. - The file is linearized. A linearized file, saved for fast web view, has two
%%EOFmarkers with no edits at all, andqpdf --check document.pdfreports "File is linearized". Cutting one at its first marker gives a broken file, not an earlier edit: qpdf couldn't read the result. Treat the count as a reason to look, not a verdict. - A marker appears by coincidence. The bytes
%%EOFcan in principle occur inside content, so check that the cut file opens and shows what you expect.
Also remember that qpdf --qdf expands only the file's current state, so count and cut on the original, not an expanded copy. Incremental saves and what they leave behind explains the mechanism in more depth, keeping the original when you redact covers why you'd want the old file around, deleting pages securely shows what removal leaves behind, and how to tell if a PDF has been edited covers what the markers can and can't show.
Frequently asked questions
Can I recover a previous version of a PDF?
Often, yes. Try Preview's File > Revert To > Browse All Versions first, then Time Machine, and finally the PDF's own earlier saves. Each depends on a record existing: macOS saved versions, a backup that ran, or a file saved incrementally. If none of those applies, there's nothing to recover.
How do I restore a previous version of a PDF on a Mac?
Open it in Preview, choose File > Revert To > Browse All Versions, move through the versions with the arrows or the timeline, and click Restore. Hold Option and click Restore a Copy to keep the current file. Click Done to leave without changing anything.
Does a PDF have version history?
Not as a feature of the format. Version history on a Mac comes from macOS Versions and from Time Machine. A PDF can also hold earlier saves inside the file when it was saved incrementally, which you can count by its %%EOF markers.
How often does macOS save versions?
Apple says a version is saved automatically every hour, or more often when you're making many changes, and also when you open, save, duplicate, lock, rename or revert a document. Apple doesn't list which apps support it. In Preview, File > Revert To shows what's there.
Can I recover an older version of a PDF that was overwritten?
Possibly. Browse All Versions may still have it, and so may a Time Machine backup made before the overwrite. If the program that saved it did so incrementally, an earlier generation may sit inside the file. If the file was rewritten from scratch and you have no backup, it's gone.
Why does my PDF have two %%EOF markers?
Either it was saved incrementally, with the old content kept, or it's linearized for fast web viewing, which writes two markers without any edit. The count alone doesn't tell you which. Cut a copy at the first marker and see whether it shows different content.
Is it a privacy problem that a PDF keeps its old versions?
It can be. Anything removed in a later incremental save can still be in the earlier bytes, so a file that looks clean may hold what you deleted. Before sharing, check the marker count, and create a clean rewritten copy if you need to.
Doing it in Basalt
Basalt is useful from the other side of this problem. Every tool writes a new file and never modifies the original, so nothing you do in Basalt overwrites the file you started with. Its Inspect tool counts the saved generations in any PDF and reports them as exposed, because the trick above recovers what someone removed. A count above one isn't proof, since a linearized file also shows two. Redaction and the Strip metadata step in Run a Procedure both write the result as one generation. Basalt doesn't restore earlier versions for you, and it doesn't read Time Machine or macOS Versions. The engine that opens documents has no network entitlement. It's $29 once for up to three Macs, free for 24 hours.
Redaction that proves itself
Basalt destroys the content you mark, then re-opens the file it wrote and proves the content is gone before it saves anything. Your documents never leave your Mac.