Ever had a zip file turn into a cpgz file? This is an infrequent problem, but here’s what happens; When the .zip file is attempted to be unzipped, it extracts into a .cpgz file, which then can also be launched in Archive Utility, only to then turn back into a .zip file, which then turns into a .zip.cpgz file, and basically the archive gets stuck in an infinite loop as it’s being decompressed into one variation of the other, over and over again. Annoying, right?
Why this happens isn’t always completely clear, but it can be indicative of a few things:
- Corrupted file, either during download or from origin
- Incomplete download, stopped at 99% done or similar
- Certain web browsers mishandling a file during or after the download process
- A bug
Accordingly, dealing with the zip cpgz loop is usually best handled in a few different ways. Before beginning, you may want to check the md5 hash or SHA1 of the origin file if possible, that can easily tell you if the file was corrupted or is incomplete. Nonetheless, not all servers provide you with either, so we’ll cover three ways to handle this issue without that, and crack open that error prone zip archive once and for all.
1: Download the File Again with a Different Browser
If you downloaded the original file with Firefox, try Chrome or Safari, and vice versa. Sometimes it’s just a matter of redownloading the file again before it unzips normally. This is great for smaller files, but large downloads don’t always make sense to do this with, and if you know for sure the file isn’t corrupted because of checking md5/sha1 sums or otherwise, you can attempt two other options.
2: Unzip from the Command Line
The command line unzip tool is often able to break archives out of the .zip to .cpgz cycle, do the following with the original .zip archive:
- Launch Terminal, found in the /Applications/Utilities folder
- Find the .zip file in the Finder and have it easily accessible
- At the command line type “unzip ” followed by a space, then drag and drop the .cpgz or .zip file into the terminal window to automatically enter the full path to that file, then hit return
- The archive should expand as usual, giving you the contents
The command line method should work basically every time, as it will forcibly extract even partially downloaded files. If you know the file is only partially downloaded though (by way of checking md5 hash or otherwise), you really ought to just download the file again.
3: Install & Use The Unarchiver
The Unarchiver is a third party tool that can be thought of as a swiss army knife of compression formats, able to work with virtually any archive file format you can throw at it. It works in much the same way as the default Archive Utility, only running when an archive is encountered, which it quickly decompresses then quits again. As such, it can also be used to forcibly extract problematic zip/cpgz files:
- Download The Unarchiver for OS X and install it, make sure it associates with all archive formats
- Open the problematic .zip or .cpgz file (generally focusing on the origin zip is best) through Unarchiver and let it decompress
The archives files should now be accessible as intended.
On a quick side note, with Archive Utility having some crashing problems lately, there has never been a better time do grab an alternative like The Unarchiver. It’s free, handles archives of just about any conceivable format, and is highly recommended.
This troubleshooting post comes in response to a question we recently got recently on Twitter (don’t forget to follow us there too), and, as luck would have it, I then encountered the same issue myself after downloading the mouse sharing app Teleport. For my purposes, I used the command line method, but Unarchiver was also confirmed to work just as well.