Skip to content

Taking over zip and unzip

With Replace zip and unzip chosen when installing, typing zip runs squeeze and typing unzip runs unsqueeze. Nothing you rely on changes:

  • A plain zip is still made by Apple's own zip, and a plain zip is still opened by Apple's own unzip. Same options, same output, same exit codes, same files.
  • squeeze steps in only where it can do better: a password made strong, a 7z or Apple Archive, or settings you've chosen.
  • Apple's own programs, /usr/bin/zip and /usr/bin/unzip, are never changed. Taking over adds two links in /usr/local/bin, which Terminal finds first.

What changes, and what doesn't

You type What happens
zip -r site.zip Website Handed to Apple's zip, exactly as before.
zip -e tax.zip Tax squeeze asks for the password. With one of at least 20 characters it makes the zip itself, protected by AES-256 instead of zip's weak classic password. With a shorter one, Apple's zip makes it, with its classic password, and squeeze says so.
zip -r backup.7z Documents A name ending .7z makes a 7z, with zip's own options. .aar makes an Apple Archive.
unzip photos.zip Handed to Apple's unzip, exactly as before, with the safety checks first.
unzip backup.7z unsqueeze unpacks it: 7z, Apple Archive, RAR, tar and more.
unzip tax.zip (AES-256) unsqueeze unpacks it, asking for the password, as Apple's unzip can't.

AES-256 zips and other people

Finder's Archive Utility and Apple's unzip can't open AES-256 zips. 7-Zip, Keka, The Unarchiver and QwikSqueeze can. Use QwikSqueeze in the Finder to open AES-256 protected archives.

The safety checks

Before any archive is unpacked, by Apple's unzip or by unsqueeze:

  • there must be enough free space, leaving at least the amount set by least-free-space;
  • the archive mustn't grow by more than largest-growth times when unpacked, which stops "zip bombs";
  • unpacking changes nothing if anything fails, never writes through a link, and never escapes its folder.

Each can be changed in the settings file, or for one command with its --ignore- option.

Giving zip and unzip back to Apple

sudo squeeze --restore-zip

prints squeeze: zip and unzip are Apple's again. squeeze and unsqueeze stay installed. To take them over again:

sudo squeeze --replace-zip

prints squeeze: zip and unzip now run QwikSqueeze. sudo squeeze --restore-zip gives them back to Apple.

Both need your Mac's password, because they change /usr/local/bin, which only an administrator can change. They change only QwikSqueeze's own links: if something else has put a zip there, it's left as it is and squeeze says so.

Running Apple's tools directly

To use Apple's own zip or unzip for one command, type its full path: /usr/bin/zip or /usr/bin/unzip.