How to Zip and Password Protect a Folder on Mac

If you are sending sensitive financial documents, personal photos, or confidential client data over the internet, compressing them into a standard ZIP file isn’t always enough to ensure privacy. If the email is intercepted or the flash drive is lost, anyone can extract the files.

To truly secure your data before sharing it, you should wrap the ZIP file in strong encryption. While Mac has a built-in “Compress” option for zipping files, it lacks a button to add a password. However, you can achieve this quickly using a simple Terminal command.

In this guide, you will learn how to zip and password-protect a folder on a Mac.

How to Password Protect a ZIP Archive via Terminal

This process uses macOS’s built-in zip utility, meaning you don’t need to download any third-party software.

  1. First, place all the files you want to protect into a single folder on your desktop. Name it something simple, like SecretData.
  2. Open the Terminal app (you can find it by pressing Cmd + Space to open Spotlight Search, typing “Terminal”, and pressing Enter).
  3. In the Terminal window, you need to navigate to the desktop. Type the following command and press Enter:
    cd Desktop
  4. Now, type the zip command using the -er flag (which tells it to encrypt and process folders recursively). Use this format:
    zip -er ArchiveName.zip FolderName
    For example, to zip your SecretData folder, type:
    zip -er SecureFiles.zip SecretData
  5. Press Enter.
  6. The Terminal will prompt you to Enter password. Type a strong password. Note: As a security feature, the characters will not appear on screen as you type. Press Enter.
  7. It will ask you to Verify password. Type it again and press Enter.

The Terminal will quickly compress the files. Once it is finished, you will see a new file on your desktop called SecureFiles.zip.

How to Open the Protected ZIP File

You can now safely email or transfer this ZIP file. When the recipient (or you) attempts to open it, macOS will handle the decryption natively.

  1. Double-click the protected ZIP file.
  2. A small macOS security prompt will immediately appear, asking for the password.
  3. Type the password and click OK.

The file will instantly decompress, revealing the original folder and its contents. If the password is incorrect, the extraction will fail, keeping your data secure.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.