When unzipping a .zip file by double-clicking on the .zip file via the Finder, I notice that plaintext files have their execute bit on. Unzipping an equivalent .tar.gz file does not exhibit this behavior. Why?

For example, unzipping this zip file will result in the LICENSE, README.md and CONTRIBUTING.md (plaintext files) to be marked as executable. But unzipping this .tar.gz file does not exhibit this behavior.

When unzipping each using the command line unzip utility, OSX does not mark the files as executable. So why is the Finder doing this? It seems strange, and insecure, for it to be marking plaintext files as executable.

The ZIP format does not contain information about Unix permissions (see ZIP, file headers). By default all files are then marked as executable.

Tar can store this information and by untarring it is possible to restore them (see tar, file format).

  • Ohhh! I always wondered why Linux archives tend to be .tarred rather than .zipped! – tjt263 Nov 6 '15 at 0:53

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.