While macOS includes a built-in Archive Utility that allows you to right-click and compress files into a ZIP archive instantly, it lacks a graphical user interface (GUI) for adding password protection. If you need to securely send sensitive documents like financial records or personal scans over the internet, an unprotected ZIP file is highly vulnerable. Fortunately, you do not need to purchase expensive third-party encryption software; you can password protect a ZIP file natively on your Mac using the Terminal.
Using the Terminal to Encrypt a ZIP File
The macOS Terminal provides direct access to the underlying Unix command-line utilities, including a powerful tool for creating encrypted ZIP archives.
- Open the Terminal application. You can find it by pressing Command + Spacebar to open Spotlight Search, typing “Terminal”, and pressing Enter.
- To ensure your ZIP file is saved in an easily accessible location, tell the Terminal to navigate to your Desktop. Type the following command and press Enter:
cd ~/Desktop - Next, you need to use the
zipcommand with the-e(encrypt) and-r(recursive, if you are zipping a folder containing multiple files) flags. The syntax is:zip -e -r ArchiveName.zip /Path/To/Your/FileOrFolder - The easiest way to input the file path without typing it manually is to type
zip -e -r SecureArchive.zip(making sure to leave a space at the end), and then drag and drop the folder or file you want to compress directly from Finder into the Terminal window. The Terminal will automatically fill in the correct path. - Press Enter to execute the command.
- The Terminal will prompt you to Enter password:. Type your desired password. (Note: for security reasons, no characters or asterisks will appear on screen as you type. This is normal). Press Enter.
- You will be prompted to Verify password:. Type it again and press Enter.
The Terminal will quickly process the files and generate a new file named SecureArchive.zip (or whatever you named it) directly on your Desktop.
Testing the Encrypted File
Before you delete the original unencrypted files or email the secure archive to someone else, you should always test it to ensure the encryption worked correctly.
Simply double-click the newly created ZIP file on your Desktop. Instead of automatically extracting the contents, the macOS Archive Utility will immediately prompt you with a dialogue box asking for a password. If you enter the correct password, the files will extract normally. Without the password, the contents remain completely inaccessible.