Create a password-protected zip on Mac

Encrypt a folder or files into a password-protected archive from Terminal.

macOSZip & ArchivesTerminalLow risk
Run the command below — Terminal asks for a password twice, then writes secret-archive.zip to your desktop.

01Command

Command
$ zip -er ~/Desktop/secret-archive.zip ~/Documents/ProjectFolder

02What it does

The built-in zip supports classic password encryption: -e prompts for the password, -r includes folder contents recursively (plain zip -e secret.zip file.pdf works for single files). The recipient unzips with Finder or unzip archive.zip and enters the same password. The archive name goes before the files to archive. For stronger AES-256 encryption and filename hiding, use 7z from Homebrew (7z a -p archive.7z folder), since zip's legacy ZipCrypto is weak.

03Risk

RiskLow risk
CompatibilitymacOS 10.11 El Capitan – 15 Sequoia
!Warning: Zip passwords are case-sensitive, and legacy zip encryption is crackable by brute force — use long passwords and 7z for sensitive data.

04Undo

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

05Sources

  • macOS zip command reference
    SS64 · technical · 2026-09-16
    Evidence: zip -e prompts for a password to encrypt the archive; -r recurses into folders.

Last verified: 2026-09-16 · Category: Security & Privacy

06Related solutions