Getting files back
'Corrupted' is the last explanation to accept, not the first. Most unopenable files are something simpler.
The extension is a claim, not a fact:
file ~/Downloads/mystery.pdf
file inspects the contents. A "PDF" that is actually HTML document text is a failed download page; a "docx" that is Zip archive is normal (that is what docx is); a "JPEG" that is data is likely truncated.
A 0-byte or suspiciously tiny file is an interrupted download or copy. There is nothing to repair — re-download it.
ls -lh ~/Downloads/mystery.pdf
File → Open → Repair exists on some versions
less file or a code editor shows what is readable insideOffice and iWork documents are zip archives. When one is damaged:
cd /tmp && unzip -o ~/Documents/broken.docx -d broken_doc
The document text lives in word/document.xml. Even from a badly damaged file, the text often extracts intact — formatting is what dies.
A file that macOS refuses to open with vague warnings may just be quarantined:
xattr -l file
xattr -d com.apple.quarantine file
Only do that for files you trust.
If the file is genuinely damaged, the recovery routes are the same as an overwrite: app Versions, Time Machine, cloud version history. A corrupted current version with a healthy version from yesterday is a solved problem.
file <path> reports what the contents actually are; a mismatch with the extension usually explains the failure better than corruption does.
Often partially — .docx is a zip, and the text inside word/document.xml frequently survives even when the file will not open.
Everywhere keeps track of every file on your Mac, including the folders Spotlight hides and drives you have unplugged. Free for a day, then $19 once.
Version 2.20.3 · macOS 13+ · 4.7 MB · notarised