I have a build system with a command line driven batch file that uses jar (from Java JDK) on a Windows machine to make a zip file like this ...

jar cf c:\target\Application-1.5.zip -C Application-1.5/ .

It "zips" up everything in the Application-1.5 directory into zip file Application-1.5.zip.

I used jar because there's no zip command at the command line on Windows.

When I download the zip file on a Windows 10 machine, Windows extracts the zip fine.

However, when I download the zip file on my MacBook (Catalina), and double-click on the zip file, the Mac won't unzip the file ... it says ... "Unable to expand "Application-1.5.zip". It is an unsupported format.

Also ... when I use the jar command on the Mac to unzip it like this jar -xf ./Application-1.5.zip it works, so the file is "valid" but Mac's built-in unzipper doesn't like it.

What do I do to make a zip file that Mac will like?


I worked around my problem by installing 7-zip on Windows 10 and using that instead of jar like so ...

7z a c:\target\Application-1.5.zip .\Application-1.5\* -r 

Mac likes the zip file produced by 7-zip, so this will work for me.

But I'd still like to know how to make a zip file with jar that Mac's default unarchive can unzip.

  • WHY Apple does anything is officially off topic as Apple never tells why. Suffice it to say that the Apple built-in un-zipper is good for very basic tasks but lacks features. I use "The Unarchiver" on my Mac. There are other alternatives. – Steve Chambers Nov 27 '20 at 14:26
  • @SteveChambers Thanks for "the unarchiver" tip, but I'm planning to distribute this zip file to customer's computers, so I can't expect them to have any non-default unarchive tool. Also, I'll re-word my statement ... I'm not so much interested in "why" Apple did something, as I'm interested in how to make it work for my needs. Cheers. – AvaTaylor Nov 29 '20 at 13:04

Thanks for posting this interesting question.

Looking under the hood of Archive Utility, it turns out that it does two things to check the file type:

  1. Check the file extension: .zip in your case.
  2. Check the file magic using /usr/bin/file.

In order to detect the file as a valid zip file, the file magic result must say "Zip archive data". I'm guessing that the Archive Utility developers didn't want to rely on the file extension to determine whether something is a zip, so they rely on the file output.

You can find out the file output that was produced by setting the following defaults key:

$ defaults write com.apple.archiveutility log-commands -bool TRUE

and opening the file in Archive Utility. Then the output will show in the system log (Console.app).

Archive Utility  magic: "Desktop/test/empty_jar.zip" -> "Java archive data (JAR)

(You could also run file asdf.zip yourself to find out the magic.)

You can see that file detected the zip as a JAR file, not a Zip file. This is sort of a "feature" of the JAR format, which is a Zip but may have a special 0xcafe tag. This tag seems to be a bit of a rabbit hole, but suffice it to say, the jar utility does add it to files it generates.

Note: I'm running High Sierra. YMMV with other versions.

Another way to generate Zip files on Windows is to use Powershell's Compress-Archive. Other readers may want to check into that since it doesn't require installing any software.

  • Very interesting. Thank you for the detailed answer. – AvaTaylor Nov 29 '20 at 23:44

You must log in to answer this question.

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