Password-Protect a Zip File with zip -e

Encrypt an archive from Terminal before emailing or uploading it.

macOSZip & ArchivesFilesarchivesecurityLow risk
Run `zip -e archive.zip file1 file2` and enter the password twice when prompted.

01Command

Command
$ zip -e -o 资料.zip 合同扫描件.pdf

02What it does

The built-in zip supports symmetric encryption via `-e`; each member file is encrypted and zip asks for the password twice. Add `-o` to obscure (scramble) file names in the listing, since standard zip encryption leaves filenames readable to anyone inspecting the archive structure. Recipients can open it with any unzip tool, including Finder’s built-in extractor.

03Risk

RiskLow risk
!Warning: Standard zip encryption (ZipCrypto) is weak — use it for casual sharing, not for sensitive data; prefer 7z/AES or an encrypted disk image (hdiutil) for strong protection. If you forget the password there is no recovery.

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

Last verified: 2026-09-18 · Category: Files & Folders

06Related solutions