DEV Community

Cover image for How to password protect zips on Mac ๐Ÿ”‘
Chris Bongers
Chris Bongers

Posted on โ€ข Originally published at daily-dev-tips.com

9 2

How to password protect zips on Mac ๐Ÿ”‘

If you're on Windows, you might think, but why?
Well, Mac doesn't offer a GUI interface for password protecting zips.

Yes, bizarre, right?

We can right-click a file/folder and compress it into a zip.

But we can, by using our best friend The Terminal password, protect our zip files!

Mac default zip function

Using terminal to password protect zip files on Mac

So let's open our favourite terminal program (mine is iTerm2) and enter the following command.

zip -er ~/Desktop/super_secure.zip ~/Desktop/secure.csv
Enter fullscreen mode Exit fullscreen mode

The parameters are as follows:

  • zip - The actual zip command
  • -er - Encrypt Recursive
  • ~/Desktop/super_secure.zip - Output zip name
  • ~/Desktop/secure.csv - Input file/folder

Once we run this, we get prompted to type a password.

You don't see any input on these password fields!

Press enter, and you need to verify the password.

Secure-zip on Mac

We now created a secure zip.

If we try to open this zip, we see the following prompt.

Zip with password on Mac

Thank you for reading, and let's connect!

Thank you for reading my blog. Feel free to subscribe to my email newsletter and connect on Facebook or Twitter

Image of Timescale

๐Ÿš€ pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applicationsโ€”without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read more โ†’

Top comments (7)

Collapse
 
darkwiiplayer profile image
๐’ŽWii ๐Ÿณ๏ธโ€โšง๏ธ โ€ข

How to password protect zips on Mac

  1. Install Linux
  2. tar xcf
  3. gpg --symmetric

๐Ÿ‘

Collapse
 
dailydevtips1 profile image
Chris Bongers โ€ข

That seems like more steps, and mac runs unix so I even think these commands will work

Collapse
 
darkwiiplayer profile image
๐’ŽWii ๐Ÿณ๏ธโ€โšง๏ธ โ€ข

Yes, it was a bit of a "mac bad linux good" joke. GPG-Signed tarballs aren't exactly user-friendly anyway, though they come with their own advantages (like signing, optional asymmetric cryptography, etc.)

Collapse
 
madza profile image
Madza โ€ข

Yup, on Windows I just normally use 7zip for this ๐Ÿ˜‰

Collapse
 
dailydevtips1 profile image
Chris Bongers โ€ข

Yep way easier on Windows ๐Ÿคฆโ€โ™‚๏ธ

Collapse
 
gregorywitek profile image
Gregory Witek โ€ข

Does Windows provide a built-in archiver with password protection?

I know there external apps that do it, but there are a couple for MacOS as well (even a free one, Keka: keka.io/en/)

Collapse
 
dailydevtips1 profile image
Chris Bongers โ€ข

I thought it came default, but to be honest not 100% sure?
Indeed there are third-party apps that do the same.

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up