How can I update my version of `unzip` to version 6.00 or higher?

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


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


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.