Command-Line Tool

BetterZip 6 ships a small command-line tool that drives compress, extract, test, list, info, and open operations from Terminal. It forwards the work to the running BetterZip app over AppleScript, so it picks up your presets, saved passwords, and filters along the way.

Installing the tool

From the BetterZip menu choose Install Command-Line Tool…. BetterZip creates a symbolic link at /usr/local/bin/betterzip pointing at the script bundled inside the app. If /usr/local/bin isn’t writable, you’ll be prompted for an admin password.

The same menu entry switches to Uninstall Command-Line Tool once installed; choose it to remove the symlink.

Usage

betterzip compress [OPTIONS] FILE...
betterzip extract  [OPTIONS] FILE...
betterzip test     FILE...
betterzip list     FILE
betterzip info     FILE
betterzip open     FILE
betterzip help

Single-letter aliases work too: c, x, t, l, i, o.

compress

  • --preset NAME: use a named save preset.
  • --format FORMAT: one of zip, tar, tgz, tbz, txz, tzst, tbr, 7z, rar, dmg, iso, xar.
  • --password PASS: encrypt with this password (Strong encryption).
  • --destination DIR: where to put the new archive.
  • --individual: make one archive per input file instead of bundling everything together.

extract

  • --preset NAME: use a named extract preset.
  • --password PASS: password for an encrypted archive.
  • --destination DIR: where to extract.

Synchronous vs. queued

The behaviour of each subcommand maps onto how BetterZip handles it inside the app:

  • compress and extract are queued. The command returns immediately after handing the job to BetterZip’s operations queue, which is what shows progress and handles any password prompts.
  • test, list, and info are synchronous: they wait for BetterZip to finish and print the result to stdout. test exits non-zero if any archive fails.
  • open simply opens the archive in BetterZip’s GUI.

Examples

betterzip compress file1.txt file2.txt
betterzip compress --preset "My Preset" *.pdf
betterzip compress --format 7z --password secret project/
betterzip extract archive.zip
betterzip extract --destination ~/Desktop archive.rar
betterzip test backup.zip
betterzip list archive.7z
betterzip info archive.zip

For something more programmatic with structured input and output, look at the Shortcuts actions instead.