How to create and password protect a zip file on macOS

Tax time is here and many of us will be sharing sensitive information from our financial institutions with our accountants. If there was ever a time to vigilant with securing your private data, this would the moment! Here's how you can create a compressed zip file with your sensitive data and password protect it on natively macOS.

Prep your files

Since we'll be using the terminal application that is native on macOS, you'll want to make the compression of your files as simple as possible to avoid long strings of commands. So if you have multiple files for compressing and protecting, you can organize them into a single folder using Finder.

  1. Open Finder.
  2. Option-click the Finder window and create a New Folder.

  3. Rename the folder, preferably something without spaces as this will make terminal commands simpler for you.
  4. Drag and drop your sensitive files into the new folder.

Once you have your files in the generated folder, you can now go on to the business of compressing and password protecting the files. Note that if you are e-mailing files, most e-mail providers have a limit on attachment sizes. Secondly, some companies disallow the reception of compressed files via e-mail due to people unknowingly opening malware and as such, your attachment may get stripped and the e-mail server. You'll need another method to transfer your files such as via Dropbox.


The terminal

Since Finder doesn't have a native password protection option, we'll have to go deeper under the skin of macOS and straight up a terminal window.

  1. Using Spotlight, type in terminal.
  2. Change your directory to the location of your folder. For example, in my instance that would be to type cd /Volumes/dataMAC and hit enter.
  3. Type in ls to make certain you see your folder.
  4. Now type in the command that will simultaneously compress and password protect the files in the form of zip -er FILESorFOLDERStoCOMPRESS.
  5. In my example that would be zip -er ForTaxes/.
  6. Hit return/enter.
  7. Next, you'll be prompted with a password prompt. Type in the password you want to use to protect the files. Enter the password twice.

  8. You should now see your compressed and password protected zip file in Finder.
  9. You can test the protection by double clicking the file.
  10. Enter your password.

  11. The file will be uncompressed into the same directory.

Final comments

This compression and password protection is agnostic to the desktop operating system so you can send it to Window users, Linux users and of course Mac users. Let us know what other ways you use compression and password protection of your files on macOS in the comments.