As Mac users, we often compress or zip files on a mac to save computer space and protect sensitive files. But we also need to be more careful about what we store. If you are compressing sensitive files, it is good to use a password to prevent the data inside the file from being accessed by others.

Although there are many applications for compressing or zipping files on a mac, the Terminal that comes with the Apple macOS is the most comfortable and easiest way to use.

We will discuss how to protect a ZIP file by entering a password and how to use the mac terminal to protect your data.

Encrypt a file with Terminal on Mac

You have to enter some unique commands in Terminal to encrypt zip on Mac. However, it’s the most straightforward method to encrypt files and folders on Mac. 

  • Open Terminal from your Utility folder or using Spotlight.
  • Suppose your file is on the desktop. So we enter the following command line and press the Return key.
cd Desktop/
  • Then, enter the command below, and do not forget to replace FILENAME with the name you want to use for the ZIP file.
zip -er
  • Next, add a space after the above code and drag your file or folder onto the Terminal window. Then, hit Return.
  • You will then have to enter the password you want to use, type it in, and hit Return. You will not be able to see any characters in the Terminal window.
  • Then, you will have to verify the password and enter it again. You will not see any characters in the Terminal. Hit Return.
encrypt a file with Terminal
Encrypt a file with Terminal

You should then see your ZIP file on our desktop, and your file now is password protected. 

How t decrypt a file on Mac?

If you need to open the encrypted zip file or decrypt the file, click on it, and a pop-up window will appear for the password. Then, enter the password that you gave above. At once, it starts encrypting files.

Decrypt a file on Mac

Even if you do not have a third-party application, you can password protect a zip file on your Mac at any time by using the Terminal.

Write A Comment