Skip to main content
Zip a Folder on Mac and Protect It with a Password - Terminal Guide

Zip a Folder on Mac and Protect It with a Password - Terminal Guide

Zip a Folder on Mac and Protect It with a Password

Want to share or archive confidential data or project folders on your Mac securely? No problem. Through the Terminal, macOS offers a simple way to zip a folder and encrypt it with a password – with no extra software at all.

Why Protect a Folder with a Password?

Whenever you store or send files, privacy matters. Encrypting a ZIP archive lets you:

  • store confidential documents securely,
  • pass data on in encrypted form (by email or cloud, for example),
  • and make sure only authorized people can open it.

The good news: this works with the tools already built into your Mac – no extra app required.

Step-by-Step Guide

1. Open Terminal

Open Terminal on your Mac. You will find it under:

Applications → Utilities → Terminal

2. Switch to the Folder You Want

The cd command takes you to the folder you want to zip. For example:

cd /path/to/folder

If you are not sure of the path, just drag the folder into the Terminal window – the path is inserted automatically.

3. Zip and Encrypt the Folder

Now use this command to compress the folder and give it a password:

zip -er foldername.zip foldername

What the parameters mean:

  • -e → turns on password encryption
  • -r → makes sure all subfolders and files are included („recursive“)
  • foldername.zip → the name of the resulting ZIP archive
  • foldername → the folder to compress

For example:

zip -er Projects.zip MyProjects

After you enter the command, Terminal asks you for a password and then to confirm it.

4. Enter the Password

Terminal now shows:

Enter password:
Verify password:

Important: for security reasons the password is not displayed as you type (no asterisks, no dots). Just type it and confirm with Enter.

5. Done! Your Encrypted ZIP Archive

Once the process finishes, you will find a new file in the same directory, for example Projects.zip. That archive is now:

  • compressed,
  • encrypted,
  • and openable only with the password you chose.

Double-click the ZIP file and you are asked for the password before it unpacks. Without the right password, the contents stay out of reach.

Alternative Method: Using Finder (No Password)

You can of course compress folders through Finder as well:

  1. Right-click the folder
  2. Choose „Compress [folder name]“

Be aware, though: this ZIP file is not password protected – it only compresses, it does not encrypt.

Testing the Encryption

To make sure the ZIP file really is protected, you can open it from Terminal:

unzip Projects.zip

If everything worked, Terminal will ask for a password. Only then is the archive unpacked.

FAQs – Common Questions

Can I add a password later?

No. The password has to be set when the ZIP file is created. To add one afterwards, you have to build the archive again.

Can I protect several folders at once?

Yes – just move all the folders you want into one parent folder and compress that.

How do I remove the password again?

Not directly. You have to unpack the archive and then zip it again without a password.

Is a ZIP password secure?

For private use, yes. For professional security (sensitive company data, for instance) you should add tools such as 7-Zip, VeraCrypt or macOS FileVault.

How should I share the password?

Never through the same channel as the file (by email, say). Use a separate channel instead – a phone call, a chat message or a password manager.

Conclusion

A single Terminal command is all it takes to zip folders securely on your Mac and protect them with a password. The method is simple, efficient and needs no additional software at all. Ideal whenever you want to send or store sensitive data safely.

That keeps your privacy intact – in the spirit of „security through simplicity“.