BASALT · JOURNAL
How to remove metadata from a PDF on a Mac
A PDF carries a second document inside it that nobody reads before sending: the author's name, the original file path, the software that produced it, the edit history, and sometimes an entire earlier draft. None of that appears on the page. All of it travels with the file.
Removing it on a Mac is not hard, but most of the obvious methods only remove the part you can see in Get Info. This post covers what is actually stored, where, and how to strip it in a way you can verify.
What "metadata" means inside a PDF
There is no single metadata field. There are at least eight places a PDF stores information about itself, and different tools clean different subsets.
The Info dictionary. Referenced from the file trailer. Holds /Title, /Author, /Subject, /Keywords, /Creator, /Producer, /CreationDate, /ModDate. /Author is usually the local account name of whoever first hit print. /Creator names the authoring application, /Producer names the library that wrote the bytes.
XMP packets. An XML block, usually referenced as /Metadata on the document catalog. It duplicates most of the Info dictionary and adds more: dc:creator, xmp:CreatorTool, xmpMM:DocumentID, xmpMM:InstanceID, and often xmpMM:History, a list of edit events naming each application and timestamp. Pages, images, and embedded objects can each carry their own XMP packet too.
The file identifier. The /ID array in the trailer, two byte strings that link a file to its ancestors. Useful for correlating a "clean" copy with the original it came from.
Embedded file attachments. Under /Names /EmbeddedFiles, or as file attachment annotations on a page. A spreadsheet can ride inside a PDF invisibly.
Annotation values. Markup annotations store an author in /T, a modification date in /M, and the comment body in /Contents. Flattening the appearance of a comment does not necessarily remove the annotation object holding the text.
Form field values. An AcroForm field has a value (/V) separate from the appearance stream that draws it. Copying a form and clearing the boxes visually can leave the old /V intact.
Optional content groups. PDF layers. Each has a name, and layers set to off still ship with the file. A layer called "Internal comments" set invisible is still fully present.
Application private data. /PieceInfo lets an authoring application stash private structures in the file. Some design tools store enough there to reconstruct the editable original.
Then there are page thumbnails (/Thumb), the structure tree with its /ActualText entries, and any digital signature fields naming the signer. I go into the visible-page consequences of several of these in hidden data in PDFs.
Why Finder and Get Info do not help
Get Info shows you Spotlight's index of the file, plus a few extended attributes macOS added, such as com.apple.metadata:kMDItemWhereFroms, which records the URL a download came from. Those attributes live in the filesystem, not in the PDF. Copying the file to a non-APFS volume or emailing it drops most of them.
The reverse is also true: clearing extended attributes with xattr -c does nothing to the Info dictionary or the XMP packet. Those are inside the file's bytes and go wherever the file goes.
The incremental update problem
This is the part that catches most people, and it is a property of the format rather than a bug in any one tool.
A PDF can be modified by appending. The writer adds new objects to the end of the file, appends a new cross-reference section, and points the trailer at it. The old objects are still physically present in the bytes; the new cross-reference table simply stops pointing at them. This is what makes signing and annotating a large file fast.
The consequence: if a tool "removes" the author name by writing an incremental update, the original Info dictionary is still in the file. Anyone who parses the earlier revision, or just runs strings over it, can read it. The same applies to text you deleted, pages you removed, and images you replaced. A file that has been edited five times may contain five stacked revisions.
The only reliable fix is to rewrite the document as a single generation, so that the output contains exactly the objects that are still referenced and nothing else. That is a full re-serialization, not an edit.
Command line methods that work
ExifTool reads and writes the widest set of PDF metadata:
exiftool -all= report.pdf
Read its warning carefully. ExifTool writes PDFs using an incremental update, so this marks the metadata as deleted rather than removing the bytes. It is an honest tool and says so. You need a second pass to collapse the file:
qpdf --linearize --object-streams=generate report_exiftool_tmp.pdf report-clean.pdf
qpdf rewrites the file structurally, discarding unreferenced objects. Running qpdf alone will not strip metadata, because the Info dictionary and XMP stream are referenced objects and therefore preserved. The two tools do different jobs and you generally need both.
To check the result, dump the file in an uncompressed, human-readable form:
qpdf --qdf --object-streams=disable report-clean.pdf inspect.pdf
Then search inspect.pdf for the author name, the original path, and the machine name. Also run exiftool -a -G1 -s report-clean.pdf to list every remaining tag by group. If a name appears in the QDF dump but not in the ExifTool output, it is embedded somewhere ExifTool does not model, such as inside an embedded image's own EXIF block or a /PieceInfo entry.
What Preview does and does not do
Exporting from Preview rewrites the document through the system PDF writer. That usually drops the XMP packet and the inherited Info fields, and it produces a single-generation file, which is genuinely useful. It also stamps its own /Producer and a fresh /ID.
What it does not do is give you any statement about the result. Behavior around annotations, form fields, and layers varies by macOS release, and re-encoding can change images in ways you did not ask for. Treat a Preview export as a plausible cleanup that still needs to be checked, not as a guarantee. The same caution applies more sharply when Preview is used for redaction, which I covered in why Preview's redaction is not safe.
Metadata and redaction are the same problem
If you are stripping metadata because a document is about to leave the building, the metadata is only half of it. Redacting the visible text and leaving the XMP history, or stripping the XMP and leaving the text under a black rectangle, both fail for the same reason: the visible layer and the data layer were treated as if they were one thing.
Any process that ends with "and then we saved it" needs a step that ends with "and then we re-opened it and proved it." Extract the text from the output. List the images. Dump the objects. Check that the words are gone and the names are gone. See how to verify a PDF redaction for the specific commands.
One more constraint worth stating plainly: uploading a sensitive document to a web tool to strip its metadata means handing the untreated original to a third party. That is the wrong direction. Cloud PDF tools carry a real risk precisely because the pre-cleanup file is the sensitive one.
A short checklist
- Rewrite as a single generation. No incremental updates in the final artifact.
- Remove the Info dictionary fields and every XMP packet, including per-page and per-image packets.
- Reset or remove the
/IDarray. - Drop embedded file attachments and file attachment annotations.
- Remove optional content groups you do not intend to ship, not just their visibility flag.
- Clear annotation author and date fields, or flatten and delete the annotations.
- Drop stale page thumbnails.
- Re-open the output and search it for the names, paths, and hostnames you expected to be gone.
Frequently asked questions
How do I remove metadata from a PDF on a Mac?
Rewrite the file as a single generation with every metadata object removed, which on a Mac means either exporting through Preview or running ExifTool followed by qpdf. ExifTool clears the Info dictionary and XMP packets, and qpdf re-serializes the document so the deleted objects are physically gone rather than just unreferenced. Then re-open the output and search it for the names you expected to be removed.
Does deleting the author in Preview actually remove it from the file?
Not necessarily, because it depends on whether the save rewrites the file or appends to it. A PDF can be edited by appending new objects and a new cross-reference table while the old objects stay in the bytes, so a "removed" author name is often still readable with strings. Exporting to a new file, rather than saving over the original, is what forces a full rewrite.
What metadata does a PDF actually store?
A PDF stores the Info dictionary fields (title, author, subject, keywords, creator, producer, creation and modification dates), one or more XMP packets containing the same data plus an edit history, a file identifier array, embedded file attachments, annotation authors and timestamps, form field values, optional content group names, page thumbnails, and application private data under /PieceInfo. Different tools clean different subsets of that list.
Will qpdf alone strip PDF metadata?
No. qpdf rewrites the file structure and discards unreferenced objects, but the Info dictionary and the XMP stream are referenced objects, so they survive the rewrite intact. qpdf is the tool that collapses stacked revisions; ExifTool or a dedicated cleaner is the tool that removes the metadata itself. You usually need both, in that order.
Does removing metadata change how the PDF looks?
No, if the tool only touches metadata objects. Metadata lives outside the page content streams, so stripping it leaves every glyph, image, and vector exactly where it was. Re-encoding tools that rasterize or recompress pages can change appearance, which is a separate operation you should avoid unless you specifically want it.
Is it safe to use an online PDF metadata remover?
It means uploading the untreated original to a third party, which is exactly the copy you were worried about. The file you send still contains the author name, the file path, the edit history, and whatever else prompted the cleanup, and you have no visibility into retention or logging. For anything covered by privilege, a protective order, or a data protection regime, strip metadata locally.
How do I check that the metadata is really gone?
Run qpdf --qdf --object-streams=disable file.pdf inspect.pdf to get an uncompressed dump, then search that dump for the author name, machine name, and original file path. Also run exiftool -a -G1 -s on the output to list every remaining tag by group. If a string shows up in the dump but not in ExifTool, it is embedded somewhere ExifTool does not model.
Does stripping metadata make a redaction safe?
No. Metadata removal and redaction are separate operations that fail independently: clean metadata with the text still sitting under a black rectangle is just as exposed as a clean redaction with an XMP history naming the case. A document leaving the building needs both, plus a verification pass that re-opens the written file and proves each one.
Doing it in Basalt
Basalt strips metadata, XMP packets, attachments, hidden layers, and stale thumbnails as part of writing the file, and it always writes as one generation, so there is no earlier revision left in the bytes to recover. The clean up tool does this on its own when you only need a metadata pass, and the same stripping runs automatically on every redaction. The built-in verifier re-opens the written file with an independent parser and proves the result before anything is saved, and the engine runs in a process with no network entitlement, so nothing leaves your Mac. It is $29 once for up to three Macs, free for 24 hours, at basaltformac.com.
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.