Encrypt zip files on Mac OS

# zip file with password
$ zip -e archive.zip file

# zip folder with password
$ zip -er archive.zip folder/


Let’s say you have the following directory layout:

$ tree
└── secrets
    ├── keys.txt
    └── passwords.txt

1 directory, 2 files

To zip a file with encryption:

$ zip -e Archive.zip secrets/passwords.txt

Archive.zip is the compressed archive.

To zip a directory with encryption:

$ zip -er Archive.zip secrets/

To unzip an archive:

$ unzip Archive.zip

You’ll be prompted for the password if it’s encrypted.

And you can also do the same through the GUI:

$ open Archive.zip

Please support this site and join our Discord!