Sometimes it will be necessary to transfer files in a zip archive that need to be protected with a password. macOS does not have a native interface for this process but it can be completed with two lines in the terminal.
Prepare
- Firstly, make a folder in an easy to find location (your desktop, downloads or other similar directory). Do not use spaces in the folder name.
- Copy the files to be included in the archive into this folder.
For the purposes of this guide, we shall assume the folder is called SecretFiles and is stored on the desktop.
Compress and Protect
- Open Terminal (you can find it under Applications > Utilities, or by searching in Spotlight)
- Type:
cd desktop
- Your prompt should now display desktop before the final symbol
- Type the command replacing ZIPNAME with the name you'd like your zip file to have, and SecretFiles with the name of the folder created in the "Prepare" step. Be sure to include the "/" at the end.
zip -er ZIPNAME.zip SecretFiles/
- You'll be prompted for a password; enter something nice and secure.
- Re-enter the password to confirm at the next prompt.
Your protected zip file has now been created. You can double-click the file to verify a password prompt appears and your chosen password works as expected.
Final Notes
Never share the password for the file using the same method the file will be transferred. Example: if you're sending the zip file by email, be sure to send the password any other way such as chat, phonecall or SMS.
Need guidance on creating a strong password? Check our handy guide on picking strong passwords.
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article