How to fix a corrupted ZIP archive on a Mac
When Archive Utility reports “Unable to expand” with Error 1 or Error 2, the ZIP is usually either truncated (the download or copy stopped early) or has a damaged index at the end of the file. Both can often be worked around: unzip in Terminal will extract every intact file and skip the bad ones, and zip -FF can rebuild the index. What cannot be recovered is any file whose bytes never arrived, so check the archive’s size against the original before anything else.
Read the error properly
Archive Utility is terse. The two messages you will see:
- “Unable to expand … (Error 1 - Operation not permitted.)” almost always means the archive is damaged or truncated, not a permissions problem, despite the wording.
- “Unable to expand … (Error 2 - No such file or directory.)” usually means the central directory (the index at the end of a ZIP) is missing or points at the wrong offsets, which is the classic signature of an incomplete download.
A third possibility is that the file is not a ZIP at all. Archives downloaded from the web sometimes arrive as a .zip that is really a RAR, a 7z, a .tar.gz, or an HTML error page with the wrong extension.
Duplicate the archive in Finder (Command+D) before trying anything, so you always have the original to go back to.
Step 1: check the size and the type
- Select the archive and press Command+I. Compare Size to what the sender or the download page said. An archive advertised as 1.2 GB that shows 480 MB was cut short; the missing 700 MB is not on your Mac, and re-downloading is the only fix.
- Open Terminal (Applications, Utilities), type
filewith a trailing space, drag the archive onto the window, and press Return:
file ~/Downloads/photos.zip
“Zip archive data” is what you want. “RAR archive data” or “7-zip archive data” means the extension is wrong and you need an app that opens those formats. “gzip compressed data” means rename it to .tar.gz and double-click it. “HTML document” means the download failed and the server sent you an error page.
Step 2: test it with unzip
unzip ships with macOS and is more forgiving than Archive Utility.
unzip -t ~/Downloads/photos.zip
You get one line per file. Entries marked OK are intact. Lines with “bad CRC” have damaged contents. “End-of-central-directory signature not found” at the top means the index is missing; keep going, because unzip can still read the local headers in front of each file.
Step 3: extract what is intact
mkdir ~/Downloads/photos-out && cd ~/Downloads/photos-out
unzip ~/Downloads/photos.zip
unzip extracts every file it can and prints a warning for each one it cannot. For a truncated archive, this recovers every file stored before the cut. Files are stored in the order they were added, so a truncated archive of a folder of photos usually gives you the alphabetically earlier ones whole and the later ones missing or partial.
If unzip refuses outright, ditto uses a different implementation and is worth one try:
ditto -x -k ~/Downloads/photos.zip ~/Downloads/photos-out
Step 4: rebuild the index with zip -FF
When the content is there but the central directory is broken, zip can scan the archive and write a new index.
- In Terminal:
zip -FF ~/Downloads/photos.zip --out ~/Downloads/photos-fixed.zip
- It may ask “Is this a single-disk archive? (y/n)”. Answer
y. - Test the result:
unzip -t ~/Downloads/photos-fixed.zip
- Double-click
photos-fixed.zipin Finder.
The single -F variant is a gentler fix for minor problems; -FF is the thorough one. Both write a new file and leave the original alone. Neither can restore data that is not in the file.
When the archive is over 4 GB
One specific cause deserves its own note. The original ZIP format caps archives at 4 GB and 65,535 entries; larger archives need the ZIP64 extension. Some older tools and some web servers produce archives that cross that line without writing proper ZIP64 headers, and the result opens on the machine that made it and nowhere else. Symptoms: the archive is over 4 GB, Archive Utility fails, and unzip -t complains about offsets. Try ditto from Step 3 first; it handles ZIP64 well. If that fails, ask the sender to split the archive into parts under 4 GB, or to re-create it with a current tool.
Step 5: let Manatee do it in one drop
Manatee handles ZIP files (and the ZIP-based Office formats, .jar and .epub) in its Repair mode. Drag the archive onto its menu bar icon or into its window, choose Repair, and it reads the archive entry by entry, keeps everything whose contents verify, and writes a new archive next to the original. The original is never modified.
The result is reported plainly: Fixed when every entry came through, Partial when some did not (you are shown what was recovered, the same way a damaged PDF is reported as 34 of 41 pages), and Not fixable when no entry could be read. It cannot recover a file whose bytes never made it onto your disk, it does not open password-protected archives without the password, and it is not an undelete tool. It runs entirely on your Mac with no upload, which matters when the archive holds client files. Free for 24 hours with every feature, then $9 once.
For the background on what repair can and cannot do, see why files get corrupted and what can actually be recovered.
Questions
I get Error 1 but the file opens fine on the sender’s Windows PC. Why?
Most often the archive was made with a tool that writes ZIP64 or encryption headers that Archive Utility does not handle. Try unzip or ditto from Terminal first. If the archive is password-protected, Archive Utility cannot open it at all; unzip will prompt for the password.
The ZIP is complete but one file inside has a bad CRC. Can that file be saved?
unzip will extract it anyway if you confirm, and you get the bytes as stored, which may be partly usable (a text file with a damaged middle, a video that plays up to a point). A bad CRC on a single entry usually means a bit flipped in transit or on a failing drive; re-downloading the archive is the reliable fix.
Is a corrupted ZIP a sign my drive is failing? Not by itself. One bad archive is nearly always a transfer that stopped. Several files going bad on the same drive in a short time is a different story; back the drive up and run First Aid in Disk Utility.
Can Manatee crack the password on an encrypted ZIP? No. It does not attempt password recovery on any file type.