8

Its a common problem that, when unzipping (read: 'open by double-click'), some .zip files result in a similar sized .cpgz file. But you expected an unzipped file or folder instead.

The default unzip program in OS X is '/System/Library/CoreServices/Archive Utility.app'

When you try to unzip it in the Terminal (/usr/bin/unzip) you see the following:

$ unzip SE.zip

Archive:  SE.zip
warning [SE.zip]:  zipfile claims to be last disk of a multi-part archive;
  attempting to process anyway, assuming all parts have been concatenated
  together in order.  Expect "errors" and warnings...true multi-part support
  doesn't exist yet (coming soon).
error [SE.zip]:  missing 8256083459 bytes in zipfile
  (attempting to process anyway)
error [SE.zip]:  attempt to seek before beginning of zipfile
  (please check that you have transferred or created the zipfile in the
  appropriate BINARY mode and that you have compiled UnZip properly)

I have Mavericks 10.9.5 running, and a unzip -v learns us we are on version 5.52:

$ unzip -v
UnZip 5.52 of 28 February 2005, by Info-ZIP.  Maintained by C. Spieler. Send
bug reports using http://www.info-zip.org/zip-bug.html; see README for details.
...

The funny thing is, the same 'corrupt' zip file extracts fine on my CentOS system. There is no error and the file seems fine. My CentOS system runs unzip version 6.00:

$ unzip -v
UnZip 6.00 of 20 April 2009, by Info-ZIP.  Maintained by C. Spieler.  Send
bug reports using http://www.info-zip.org/zip-bug.html; see README for details.
...

My question: How can I update my version of unzip to version 6.00 or higher?

And affiliated question: Will my new version of OS X unzip also have affect on the default unzip 'Archive Utility.app'?

ps. I prefer the use of a package manager like brew above compiling from source. brew install unzip results in: Error: No available formula for unzip

  • Use macports it does have unzip version 6.0 :) – user151019 Oct 10 '14 at 13:14
  • ha ha brew vs. macports... I have my system already marinaded with brew. But mightbe I can check the source. Thanks anyway! – CousinCocaine Oct 10 '14 at 13:19
  • Was your "affiliated" question answered? "Will my new version of OS X unzip also have affect on the default unzip 'Archive Utility.app'?" I was wondering the same thing. – EJ Mak Feb 11 '18 at 16:16
8

Using Homebrew (as requested):

$ brew tap homebrew/dupes
$ brew install unzip

This will install unzip at (considering defaults) /usr/local/Cellar/unzip/6.0/bin/unzip

You can then alias it as unzip6 somewhere in your path.

Also, you may want to to try "The Unarchiver" from the app store. Much more useful IMO then Apple's Archive Utility.

UPDATE

dupes has been deprecated in Homebrew, so brew tap homebrew/dupes is no longer necessary. All you need now (assuming Homebrew is installed) is:

brew install unzip

Then you can add a link to /usr/local/bin with:

ln -s /usr/local/opt/unzip/bin/unzip /usr/local/bin/unzip6

Now the system unzip should work with unzip and Version 6 will work with unzip6

  • I was missing the brew tap homebrew/dupes. No clue what is does but now I can do a brew install unzip. thnx a bunch. – CousinCocaine Oct 10 '14 at 14:06
  • Although I now have a working unzip 6.0.0, just like I wanted, now I have a new error. Mightbe you can help me with it, but it is beyond this topic. skipping: foobar need PK compat. v4.5 (can do v2.1) for each file in the zip. – CousinCocaine Oct 10 '14 at 14:12
  • Can't solve the problem, though my guess is the file was zipped using PKZip and it did something... unique – sdmeyers Oct 10 '14 at 14:19
  • BTW the tap command opens up new apps in brew that are left out of the default for various reasons (specifically is adds new specific homebrew git repo's). This includes things like dupes, games, and php etc. – sdmeyers Oct 10 '14 at 14:25
  • 1
    @EJMak Using The Unarchiver app may be your best bet. That said... When Homebrew installs something already part of MacOS (i.e. unzip), it will not link it so it is easily useable. In the case of unzip Homebrew will install it to /usr/local/opt/unzip/bin/unzip. To create an alias or a link you use the following command (from the command line (terminal.app)) ln -s /usr/local/opt/unzip/bin/unzip /usr/local/bin/unzip6. Assuming /usr/local/bin is in your path, you can use unzip6 from the command line to use this, or unzip to use the Mac default. – sdmeyers Feb 13 '18 at 16:59
3

You may find that p7zip does what you want. Use brew install p7zip to install, then run 7z -h to get some help.

I'm using 7z t on a 20GB zipfile as I write this, to test its integrity. Both Unzip 5.52 and Unzip 6.0 choked on it.

  • Yes! E.g. p7zip works very nicely to uncompress Microsoft's IE VM images, which are 5 GB+. – Alessandro Vernet May 12 '16 at 18:31
  • Cool, but it doesn't answer the question. – EJ Mak Feb 11 '18 at 15:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .