Manatee

A DOCX or XLSX that downloaded as a .zip on a Mac

You clicked a link to a document or spreadsheet and got a .zip instead, or a folder full of oddly named items such as [Content_Types].xml, _rels and word. Nothing is lost. DOCX, XLSX and PPTX files are ZIP archives on the inside, so a document that arrives as .zip is usually the right file with the wrong extension. Renaming it is often the whole fix, and a folder takes one extra step.

Why a document turns into a zip

A DOCX is a bundle: the text lives in XML files, the images in a media folder, and the whole set is packed with ordinary ZIP compression. Your Mac decides what a file is from its extension, so anything that changes the extension changes how the file is treated.

  • The website labels the download as a generic archive. Some document portals and intranet systems send every file as “compressed data”, and the browser names it accordingly.
  • Safari unpacked it for you. With “Open safe files after downloading” switched on in Safari, Settings, General, Safari expands zip archives as soon as they land. A document that arrived as .zip becomes a folder of parts.
  • It really is a zip. Sometimes the sender compressed the document, or several documents, on purpose. Then the zip contains a DOCX rather than being one.

Step 1: find out what you have

Open Terminal and list the archive’s contents without extracting anything. Type unzip -l, a space, then drag the file into the Terminal window and press Return:

unzip -l ~/Downloads/report.zip

Read the names in the list:

  • word/document.xml means it is a DOCX.
  • xl/workbook.xml means it is an XLSX.
  • ppt/presentation.xml means it is a PPTX.
  • A single report.docx or similar means it is a real zip holding a document. Double-click it in Finder to expand it, and you are done.

If unzip reports an error such as a missing end-of-central-directory signature, the download is incomplete or damaged. Skip to step 4.

Step 2: rename it back

  1. Make extensions visible: in Finder, choose Finder, Settings, Advanced, and turn on “Show all filename extensions”.
  2. Select the file, press Return, and change .zip to .docx, .xlsx or .pptx, whichever step 1 showed.
  3. Finder asks whether you are sure you want to change the extension. Choose to use the new one.
  4. Double-click the file to open it.

Renaming changes nothing inside the file. If you picked the wrong extension, rename it again. A file with no extension that will not open covers the same trick for files that arrive with no extension at all.

Step 3: if Safari already unpacked it into a folder

First look for the original .zip in Downloads and in the Trash, since Safari may have moved the archive there after expanding it. If you find it, put it back and rename it as in step 2. Downloading the file again after switching off the Safari setting also works.

If all you have is the folder, rebuild the document from it in Terminal. The parts must sit at the top level of the archive, not inside a folder, so run the command from inside the folder:

cd ~/Downloads/report
zip -X -r ../report.docx . -x '*.DS_Store'

Type cd and drag the folder into Terminal if you would rather not type the path. The new report.docx appears next to the folder. Use .xlsx or .pptx in the command if that is what the folder held (an xl folder means a spreadsheet, a ppt folder a presentation).

Finder’s Compress command is the obvious alternative, but it is the wrong tool here. Compressing the folder wraps everything one level down, where document apps do not look, and Finder can add hidden Mac-only entries that some apps object to. The Terminal command builds exactly the archive you need.

Step 4: if it still will not open

A renamed or rebuilt file that still refuses to open was probably damaged on the way: a download that stopped early, or an archive with a broken table of contents. Download it again if you can, and compare the size with what the sender sees.

If this copy is all you have, it needs a repair rather than a rename. Manatee repairs DOCX, XLSX and PPTX files at the container level. Rename the file to its proper extension first, then drag it onto Manatee’s menu bar icon or into its window. It reads the archive part by part, keeps whatever is intact, and writes a new document beside the one you gave it, which it never modifies. The result is reported as Fixed, Partial or Not fixable, and it all happens on your Mac with no upload.

For more on what goes wrong inside these files, see fixing a DOCX that is reported as corrupt and a spreadsheet rejected because its format or extension is not valid.

The same trick for EPUB and OpenDocument files

EPUB books and OpenDocument files (ODT, ODS, ODP) are ZIP archives too, with one extra rule: the first entry must be a file called mimetype, stored without compression. The single command above does not guarantee that, so for these formats build the archive in two passes from inside the folder:

zip -X -0 ../book.epub mimetype
zip -X -r ../book.epub . -x mimetype -x '*.DS_Store'

An EPUB file that won’t open in Books covers the other reasons a book refuses to open.

Stop it happening again

If you would rather decide for yourself when an archive is expanded, open Safari, Settings, General and switch off “Open safe files after downloading”. Zip files then stay as zip files until you double-click them, and a mislabeled document stays in one piece, ready to rename.

Questions

Is it safe to rename a .zip I was not expecting? Renaming does not run anything, but look before you open. If unzip -l shows an app, a script or anything other than document parts, and the sender is someone you do not know, delete it instead.

Can I read the text straight from the unpacked folder? Yes, roughly. The text of a DOCX lives in word/document.xml, and TextEdit will open it, but you will be reading between a great many tags. Rebuilding the document with the command in step 3 is quicker.

Why do I get a .zip when I download several files at once? Many sites bundle a multi-file download into one archive. That is a real zip holding real documents, so double-click it to expand it and leave the names alone.