Create password-protected zip files on Mac

A Developer 😀
3 min readFeb 29, 2024

--

Compressing files is a common and widely used practice to move large files from one device to another. But compression does not mean providing security from any kind of data theft. Compressed data is vulnerable to data theft in the same way as non-compressed data.

Adding a password to the compressed aka Zip file, though, can help to ensure that sensitive data is kept safe. Mac users can do it in just a few easy steps.

Adding password protection to Zip files on Mac

Before diving into the process of creating a password-protected zip file on Mac, let's take a step back and revisit the creation of the Zip file on Mac.

Creating a simple zip file on a Mac

  1. Start by making a new folder on the Desktop. Just right-click anywhere, and click New folder.
  2. Add all the desired files to this newly created folder.
  3. When ready, select all the files, right-click, and click Compress.
Compressing Selected Files

4. A ZIP file will now be created in the same folder; one can now rename this file and move it to a safe location on Mac.

Newly Created Compressed Folder

Now it's time to protect the data from any unwanted access using the password protection technique.

Use Terminal to add password protection to Zip-file

One can use Terminal to easily password-protect your ZIP files.

  1. Open Terminal from Finder > Applications > Utilities.
  2. Navigate to the folder one wants to protect. E.g. If the folder to protect is present on the desktop, then navigate to the desktop.
  3. Now run the following command in the terminal.

zip -e -r FinalDocuments.zip TestFolder/

4. Here it is important to note that FinalDocuments.zip will be the newly password-protected zip file containing all the files present inside the TestFolder.

5. As soon as the return key is clicked after the above command, the user will be prompted to provide the password.

6. As soon as the user verifies the password, the system will create a new password-protected zip with all the desired contents. In this case, the FinalDocuments1.zip file will be created containing all the files present in the TestFolder.

7. Congratulations, the password-protected zip file is created just in a few easy steps.

Open a password-protected zip file on a Mac

Below are the steps to unzip password-protected files on Mac:

  1. Double-click the password-protected zip file to extract it.
  2. A modal will pop up, asking to enter the password. Enter the correct password in the password field and click OK.
  3. The zipped file will begin extracting, and the archive’s contents will be visible in a new folder.
  4. One can access the zip file contents by opening the new folder.
  5. If one enters an incorrect password, the file will not be extracted, and one needs to enter the correct password to access the contents.

Conclusion

Data theft is real and must be taken seriously. Always try to protect sensitive data by one means or another. It is always a good practice to use the standard and well-device techniques to protect the sensitive data.

Thanks :)
Thanks :)

Happy Coding :)

--

--

A Developer 😀
A Developer 😀

Written by A Developer 😀

Reader | Traveller | Freelancer | Android & Fullstack Developer | Open-Source Enthusiast | Loves Automation

No responses yet