The built-in Mac method uses the Archive Utility, not a separate app

macOS does not have a native way to password-protect a ZIP file during compression. The Archive Utility — the tool that creates ZIP files when you right-click and select "Compress" — does not offer password options in its interface. Instead, you need to use the Terminal app and a command-line tool called zip, which comes pre-installed on every Mac.

This is faster than downloading third-party software, and the resulting file works on Windows and Linux machines the same way it works on another Mac. The trade-off is typing a command instead of clicking buttons, but the command is short and you only need to learn it once.

Key Takeaways

  • Mac's built-in Archive Utility cannot password-protect ZIP files, so you must use Terminal and the zip command instead.
  • The command is: zip -e -r filename.zip foldername, where you replace filename and foldername with your actual names.
  • Terminal will prompt you to enter a password twice before creating the file; anyone who unzips it will need that password.
  • The password-protected ZIP file works on Windows, Linux, and other Macs without installing extra software.
  • If you make a mistake, delete the ZIP file and run the command again — there is no undo.

Opening Terminal and navigating to your file location

Open Terminal by pressing Command + Space, typing "terminal", and pressing Enter. A black window will open showing a command prompt that ends with a dollar sign ($).

Type cd followed by a space, then drag the folder or file you want to compress into the Terminal window. This automatically fills in the full path. Press Enter. Terminal will move to that location. If you see an error like "No such file or directory", the path was wrong — try dragging the item in again.

You can verify you are in the right place by typing ls and pressing Enter. This lists everything in the current folder. You should see the file or folder you want to compress.

Running the zip command with password protection

Type the following command exactly as shown, replacing filename with what you want to call the ZIP file and foldername with the name of the folder or file you are compressing:

zip -e -r filename.zip foldername

The -e flag tells zip to encrypt with a password. The -r flag means "recursive" — it includes everything inside the folder, not just the folder itself. Press Enter.

Terminal will ask you to "Enter password:" and then "Verify password:". Type your password both times. You will not see the characters appear as you type — this is normal and intentional. Press Enter after each password entry. If the passwords do not match, Terminal will say so and ask you to try again.

What happens after the command finishes

When the command completes, Terminal returns to the prompt. The password-protected ZIP file now exists in the same folder as the original. You can close Terminal.

To verify the file was created, open Finder, navigate to that folder, and look for the filename.zip file you specified. Its size will be smaller than the original folder because ZIP compresses the contents.

Test the password by double-clicking the ZIP file. macOS will ask for the password before extracting. If you enter the wrong password, the extraction fails and you are prompted again. If you enter the correct password, the contents extract normally.

Common mistakes and how to fix them

If you see "command not found", you likely mistyped the command. The most common error is forgetting the hyphen before the flags: it must be -e and -r, not just e and r. Copy the command from above and paste it into Terminal, then edit only the filename and foldername parts.

If the ZIP file is created but asking for a password does not work, the password may not have been set. This usually means the two passwords you typed did not match. Delete the ZIP file (drag it to Trash) and run the command again, typing the password more carefully the second time.

If you get an error about the folder not existing, the path was wrong. Close Terminal and try again, dragging the folder into the Terminal window instead of typing the path by hand.

Password strength and what to remember

The password you set is the only way to open the ZIP file. If you forget it, the file cannot be recovered — there is no "forgot password" option for ZIP encryption. Write the password down somewhere safe if you think you might forget it, or use a password you already use elsewhere.

ZIP encryption is adequate for keeping casual snoopers out, but it is not military-grade. If you are protecting highly sensitive documents, consider using a dedicated encryption tool like FileVault (which encrypts your entire drive) or a password manager's find note feature instead.

Sending the file to someone else

Once the ZIP file is created, you can email it, upload it to cloud storage, or send it however you normally share files. The person receiving it will need the password to extract it. You must tell them the password through a separate channel — never include it in the same email or message as the file.

On Windows, the recipient can right-click the ZIP file and select "Extract All", then enter the password when prompted. On another Mac, double-clicking the ZIP file triggers the password prompt. On Linux, most file managers handle it the same way, though some users may need to use the command line.

Frequently Asked Questions

Can I password-protect a ZIP file using Finder without Terminal?

No. Finder's "Compress" option does not have a password field. You must use Terminal and the zip command. There is no graphical way to do it with built-in Mac tools.

What if I want to password-protect just one file, not a whole folder?

Use the same command, but replace foldername with the filename. For example: zip -e filename.zip document.pdf. The command works the same way for single files.

Is the password protection strong enough for banking or medical records?

ZIP encryption is basic. For highly sensitive documents, use FileVault to encrypt your entire drive, or store them in a password-protected cloud service like iCloud or Google Drive instead. ZIP is fine for keeping casual snoopers out of family photos or old tax returns.

Can I add a password to a ZIP file that is already created?

No. You must create a new password-protected ZIP file from the original folder or file. Delete the unprotected ZIP and run the zip command again with the -e flag.

What if the Terminal command takes a very long time?

Large folders can take several minutes to compress. Do not close Terminal or interrupt the command. Let it finish. You will know it is done when the prompt returns and you can type again.