I am trying to extract a ZIP file in Java which was created on a Mac using the built-in archive functionality of the Finder. As the ZIP file contains an application bundle, it is important to retain the Unix file permissions, especially the executable flag.

When extracting the ZIP file using the Finder, the permissions are retained. So I know they're stored somewhere in there.

Now my question is: how does macOS store Unix file permissions in ZIP files? Unfortunately I could not find any information about this on the net.

1 Answer 1


The permissions are stored in the same manner as they are on other Unixoid systems, such as for example Linux.

If you look at the central directory header in the zip-file, you have for each file stored in the Zip-file a field called "external file attributes". The field is at byte 36 in the header and is 4 bytes long.

The two last bytes in that field contains the file permissions on macOS - to be precise it is the last 9 bits (the least significant 9 bits). Their meaning is just like traditional Unix file permissions.

  • @bmike Regarding your edit: It is not mandatory to save permissions in ZIP-files - Finder does not provide a user interface for this, but other utilities make it optional. The permission encoding is actually not in the original Zip-standard. Also the ACLs are not stored in ZIP-files (neither on Linux), so they aren't relevant to ZIP-files.
    – jksoegaard
    Commented Jul 6, 2018 at 12:45
  • You're right, the extended attributes field contains the permissions. Thanks for the hint! Commented Jul 6, 2018 at 17:55

You must log in to answer this question.

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