How to Password Protect a Zip file in MacOS

zip folder

It’s simple to create a zip file on your Mac. Creating a password-protected zip file takes a little more effort, but it’s still relatively easy. Don’t believe me? This article will walk you through the process.

How to Zip and Unzip files

We’ll start out with how to zip or compress a file on your Mac.

  1. Find the file or folder you want to zip.
  2. Right-click the file. Most Macs don’t have a right mouse button, but you can still “right click” by holding two fingers down on your Mac trackpad, or by holding Ctrl while clicking.
  3. Select “Compress” (whatever the name of your file or folder is), and click your trackpad or mouse. Now the file or folder will be zipped to the location you choose.                                                                                                             zipfolder

Macs use a built-in Archive Utility, so it’s as easy as that. Your file’s zipped.

To unzip a file or folder on your Mac, double-click it with your trackpad or mouse. Or, if you want to unzip the file or folder with something other than the Archive Utility:

  • Right-click on the zipped file or folder with your trackpad or mouse and scroll to “Open With.”
  • Select the application you want to use to open the file.  Archive Utility

How to Create a Password-Protected Zip File

This will require using the Terminal application on your Mac.

  1. First, navigate to the Terminal application by one of the following two methods:
    1. Use the shortcut/hotkey: Command + Space bar. (You can learn more about MacOS hotkeys and shortcuts here.) This will open the Spotlights search bar on your Mac. Type “Terminal” in Spotlight, then double-click on Terminal to open it.
    2. Alternatively, you can go to Finder, scroll down to “Utilities,” and then select “Terminal” from the Utilities programs folder.
  2. In Terminal, type: “zip -e archive_name target_folder” to encrypt a file, or “zip -er archive_name target_folder” to encrypt a folder. The “-e” or “-er” instructs your Mac to create an encrypted zip file. Replace “archive_name” with what you want your archive to be called. Replace “target_folder” with the name of the folder or file you want to archive.
  3. The archive utility window will pop up a field for you to enter a password. Type the password that you will use for this archive and click OK.
  4. You’ll verify the password you’ve chosen by typing it in again when prompted. Then click OK to complete the password-protection process.

You’re all done! Now you know how to zip or compress files on your Mac, as well as how to unzip them. And you can add a password to your zipped files that contain sensitive data or anything else you don’t want spying eyes to see.

Posted by Heather on June 29, 2016

6 thoughts on “How to Password Protect a Zip file in MacOS”

Rosalea says:
Screenshots would have been much more helpful. Not everyone understands how to type in the target folder info.
Reply
Gigi says:
I can’t type a password in the Terminal…there is a key icon and nothing I type gets entered…..grrrrrrr!
Reply
Spencer says:
That’s how it works. It doesn’t show you what you’re typing. Just type it like you would any other password.
Reply
binoop says:
For Zipping a folder with password
zip -er [archive] [folder]
eg: zip -er zippedFile.zip FolderToZip
zip -er ~/Desktop/zippedFile.zip/ ~/Documents/FolderToZip/

For Zipping a file with password
zip -e [archive] [file]
eg: zip -e zippedFile.zip FileToZip.txt
zip -e ~/Desktop/zippedFile.zip/ ~/Documents/FileToZip.doc

Reply
Jimmy says:
No spaces in target folder name
Reply
Jacob says:
Use quotation marks around the path if there is a space.
zip -e “~/Desktop/File With Space.zip/” ~/Documents/FileToZip.doc
adam says:
I used the correct file name got a message saying “zip warning: name not matched: target_folder1”
Reply
ew says:
before entering the command. pls enter directory of folder..

for example: ~cd/desktop/

or if your file is in a subfolder at desktop.. then: ~cd/desktop/[folder name]

then the utility will be in that folder and you can use the command..

Reply
Andrey says:
To protect folder you need to use slightly different command: “zip –er archive_name target_folder1″
Reply
Moradeyo says:
I tried to follow you instructions about encrypting a folder/file but all it does is create an empty zip file containing a string of files similar to the path of the target folder I chose. Any idea why this could be happening?
Reply
Moradeyo says:
plus the created zip file is not protected i.e. I was able to access it without entering a password
Reply
Moradeyo says:
Also, the created (empty) zip file was accessible without the password I supposedly assigned to protect it.
Reply

Leave a Reply

Your email address will not be published. Required fields are marked *