A ZIP file that refuses to open is not necessarily dead. On Mac or Linux, the command line gets you back in fastest. Info-ZIP's zip utility ships with the operating system and includes two repair modes: -F and -FF. Use them to rebuild a broken container, test the result, and recover every file that can be saved.

What Zip -F and -FF Do

Gentler Fix with -F

Info-ZIP's zip (version 3.0) provides two repair options. The first, -F (fix), rebuilds a container whose central directory is missing or damaged but whose stored files are intact. The central directory is the index at the end of a ZIP that lists every file and its location. If that index is lost, zip -F attempts to reconstruct it from the local file headers that appear at the start of each stored item.

Deeper Scan with -FF

The second option, -FF (fix fix), is more aggressive. It ignores the central directory entirely and scans the whole file from the beginning, looking for local file headers. This rescues more badly damaged or truncated containers, because it does not rely on any pre-existing index. However, zip -FF can only recover items whose data is still present. Files lost to truncation cannot be restored.

Preparing to Repair

Make a copy of the broken file before you run any repair command. Even though zip uses --out to write to a new file, keeping the original untouched is good practice. If your container is split into multiple parts (such as .z01, .z02, and .zip), you must join them into a single file first. Combine the parts with -s 0:

zip -s 0 split.zip --out single.zip

This creates a single file you can then attempt to repair. On Linux, the tools come from the zip and unzip packages. On Debian or Ubuntu, install them with:

sudo apt install zip unzip

On macOS, these tools are present by default. If not, the system's package manager supplies them.

Repairing with Zip -F

Start with the gentler option. Run zip -F on the damaged file, specifying a new output file with --out:

zip -F broken.zip --out fixed.zip

This tells zip to read broken.zip, try to rebuild the central directory from the local headers, and write the result to fixed.zip. The original file is never overwritten because zip 3.0 requires --out with -F or -FF. That requirement protects you from making the damage worse.

After the command finishes, zip reports how many items it found and how many it could not recover. If the output shows that all were found, skip the -FF step. If not, move on to the more thorough mode.

Repairing with Zip -FF

If -F does not recover everything, use -FF. This mode scans the entire file from the start, ignoring any damaged central directory. The command is nearly identical:

zip -FF broken.zip --out fixed.zip

Because -FF scans for local file headers, it can often recover data that -F misses, especially when the container is truncated or the central directory is completely gone. It is slower on large files. It may also produce false positives if random bytes resemble a header. Always test the result.

Remember that zip -FF can only recover items whose data is still present. If a file was cut off mid-item, the remaining bytes of that entry are lost permanently. The repair tool lists which ones failed. You can then decide whether to look for a backup.

Testing the Repaired Archive

After a repair, always verify the output. The unzip utility includes a test mode that checks every item for integrity. Run:

unzip -t fixed.zip

This reads each file in the container, computes its CRC, and compares it with the stored value. If any item fails, unzip lists it and reports a checksum error. A clean output means the repair succeeded for all items. If some fail, you may need to try a different repair method or accept that those files are unrecoverable.

Testing is quick. It gives you confidence before you rely on the repaired container. It is also a good habit to test any ZIP you download or transfer, not just ones you repair.

Practical Repair Workflow

Step-by-Step Sequence

  1. Copy the damaged file to a working directory: cp broken.zip broken_backup.zip
  2. If the container is split, join the parts first: zip -s 0 split.zip --out single.zip
  3. Run the gentler repair: zip -F broken.zip --out fixed.zip
  4. Test the result: unzip -t fixed.zip
  5. If the test shows errors, try the more thorough repair: zip -FF broken.zip --out fixed2.zip
  6. Test again: unzip -t fixed2.zip
  7. If neither works, inspect the output to see which items failed, and check for a backup.

This sequence gives you the best chance of recovery while minimizing wasted effort. Start with the faster -F. Escalate to -FF only when you must.

When Command Line Repair is Not Enough

Command-line repair with zip -F and -FF is powerful, but it has limits. It cannot create data that was never written to disk. If a file was truncated before its entire content was saved, no repair tool can recover the missing bytes. Your only options then are to find a backup, re-download the file, or ask the sender for a new copy.

-FF can sometimes produce false positives, especially if the file contains a lot of binary data that resembles ZIP headers. Always test the output with unzip -t and spot-check a few extracted files if the container holds anything important. If you prefer a graphical tool or need a second opinion, an online service like zip.repair can help. For most users, the command line is the fastest and most reliable route.