How to Password Protect Zip Archives on macOS Using the Terminal

April 13, 2023

Zip archives are a convenient way to compress and share files on macOS, but they can also contain sensitive information that you want to protect. Fortunately, you can easily password protect zip archives using the Terminal. In this tutorial, we'll show you how to use the zip command to create password-protected zip archives on macOS.

To password protect a zip archive, you need to use the -e option with the zip command. The -e option tells zip to encrypt the contents of the zip archive with a password.

Here's the syntax for creating a password-protected zip archive:

zip -er archive.zip folder/

In this example, archive.zip is the name of the zip archive, and folder/ is the folder you want to compress and password protect. When you run this command, zip will prompt you to enter a password for the archive.

You can also use the -P option to specify a password on the command line:

zip -eP mypassword archive.zip folder/

In this example, mypassword is the password you want to use for the archive.

To extract the contents of a password-protected zip archive, you need to use the -P option with the unzip command:

unzip -P mypassword archive.zip

In this example, mypassword is the password for the archive, and archive.zip is the name of the zip archive.

By password protecting your zip archives, you can ensure that your sensitive files are secure and only accessible to authorized users. With the zip and unzip commands on macOS, it's easy to create and extract password-protected zip archives from the Terminal.

Share this post on Twitter