everyday mac tools

Redacting the same name across a stack of PDFs on a Mac

· 7 min read

macOS has no tool that redacts the same words across many PDFs in one pass. What works is a three-step routine: find every file and every form of the name with Spotlight, redact each file with Preview’s Redact tool, then search the redacted copies again to prove the words are gone. The final search matters more than the redaction itself, because it is the step that catches what you missed.

Work on copies, in their own folder

Preview saves changes into the file you have open, and redaction is designed to be permanent. So before anything else:

  1. Put the PDFs in one folder.
  2. Select the folder in Finder and choose File, Duplicate (Command-D).
  3. Rename the copy something like “to redact”. Leave the original folder alone from here on.

Check the file names too. A PDF called “Roe, Jane, medical summary.pdf” leaks the name however well its pages are redacted. Rename the copies now so you do not forget at the end.

List every form the name takes

A person’s name appears in more forms than you expect, and a search only finds the exact form you type. Write the list before opening a single file:

  • The full name, the surname alone, and the first name alone where it identifies the person.
  • Initials, with and without periods.
  • Possessives, and names split across two lines with a hyphen, which a search for the whole word will not match.
  • Email addresses and usernames built from the name.
  • Anything else tied to the person: phone numbers, account numbers, addresses, in every format they appear (with spaces, with dashes, run together).
  • Signatures and handwriting. These are pictures, so no search will find them; they need your eyes.

Find which files contain each term

Spotlight indexes the text inside PDFs that have a text layer, so it can tell you which files mention a term before you open any of them. In Terminal:

mdfind -onlyin ~/Desktop/"to redact" "Roe"

That lists every file in the folder whose name or text contains “Roe”. To check the whole list in one go and get each file once:

for t in "Jane Roe" "Roe" "J. Roe" "jroe"; do mdfind -onlyin ~/Desktop/"to redact" "$t"; done | sort -u

Over-matching is fine at this stage. You are building a list of files to open, not deciding what to remove.

Scanned PDFs are the gap. A scan with no text layer is a picture of words, so Spotlight sees nothing inside it and the file never appears in these results. Open each scan and try to select a line of text; if you cannot, it needs OCR before it can be searched. Make a scanned PDF searchable on a Mac covers that, and Redacting photos and scans inside a PDF explains why a scan made searchable then holds the words twice, once as pixels and once as invisible text, and both must go.

Redact each file

For each file on your list:

  1. Open it in Preview and press Command-F. Type the first term. Preview lists every match in the sidebar with its page number.
  2. Choose Tools, Redact, and drag across each match, working down the list of results.
  3. Search for the next term and repeat until the list is done.
  4. Check the pages by eye for signatures, handwriting and images.
  5. Save and close.

While you work, keep a plain note of each file, each term and how many marks you made. It takes seconds per file and answers the question someone will eventually ask: what exactly was removed?

Redaction in Preview removes content from the page. It does not touch the document’s title, author and keyword fields, bookmarks or attachments, and any of those can hold the name. Open Tools, Show Inspector to see the basic fields, and follow Remove metadata from a PDF on a Mac before you share it if the name appears there. Redacting a PDF in Preview on a Mac covers the tool itself in more depth.

Prove nothing was missed

When every file is done, run the same search again on the redacted folder:

for t in "Jane Roe" "Roe" "J. Roe" "jroe"; do mdfind -onlyin ~/Desktop/"to redact" "$t"; done | sort -u

Give Spotlight a minute to re-index the files you saved. Empty output means no file in that folder still contains any of the terms in its text or its name. If a file does appear, open it and search it with Command-F; either a mark was missed, or the name survives in the document’s own fields.

Two more checks are worth the time on anything important:

  • Copy test. In Preview, press Command-A then Command-C, paste into a new TextEdit document, and search it with Command-F. This shows exactly what text a recipient could pull out of the file.
  • Metadata check. In Terminal, mdls ~/Desktop/"to redact"/file.pdf prints every field Spotlight knows about the file. Search the output for the name.

What no search covers is images. Signatures, handwriting and faces in photos have to be checked page by page. How to check whether a PDF was really redacted has the full routine.

When the stack is large or the stakes are high

The Preview routine works, but everything depends on your attention across every file. There is no list of pending marks to review, nothing checks the output for you, and a large stack is exactly where attention slips.

Basalt is a native Mac PDF app built for this work. You review every mark before anything is applied. Its Scripts tool runs inside the same sealed engine and can propose marks for you to review, and a script never applies one without you. Procedures record a set of steps so the next batch is handled the same way. Text under a mark is removed glyph by glyph, images under a mark are destroyed and re-encoded, and metadata, XMP, attachments, hidden layers and stale thumbnails are stripped. Before any file is written, a verifier re-opens the export with an independent parser and proves the strings are absent; if a check fails, no file is written. Each export gets a signed certificate you can check with shasum and openssl, without Basalt.

If the redactions are for a legal matter, its Privilege Log tool builds a CSV or XLSX log straight from the marks. Basalt is free for 24 hours with every tool, then $29 once for up to three Macs. It works only on PDFs, and it runs entirely on the Mac.

Questions

Can Shortcuts or Automator redact a folder of PDFs? Neither includes a redaction action, so no built-in automation removes text from a PDF. Automator’s Extract PDF Text action is still useful for checking, because it turns each redacted PDF into plain text you can search.

Is it enough to search for the full name? No. Documents refer to people by surname, initials, email address and nickname. The variant list is where most misses start, so build it before you begin and add to it whenever you spot a new form.

The name also appears in the email I am sending the files with. The redaction only covers the PDFs. Check the subject line, the message body and any file names in the email before you send.