How to Password Protect a Zip file in MacOS

zip folder

The past five years have seen Apple switch from using disk-based hard drives to implementing SSDs, or solid-state drives, on almost every computer they sell. From the MacBook Air and 12″ MacBook, to the newer generation of MacBook Pros, even up to their iMac and Mac Pro line of desktop computers, Apple has become fixated on providing users with nothing but flash-based SSDs for better, faster performance and longer lifespans overall. Although a normal hard drive still typically features more storage than what we would see from an SSD, choosing a solid-state drive over a disk-based drive helps the computer start in just seconds, provide minimal launch time for applications, movies, and games, and help slim down the chassis of the computer overall. Basically, SSDs are the future of storage when it comes to computing, and it’s no surprise Apple no longer offers traditional or hybrid drives for their computers.

That said, SSDs still remain more expensive than normal HDDs, where you’ll typically be paying two to three times as much cash for the same amount of storage. This can make it difficult to manage your storage on your MacBook thanks to the smaller overall drive size. Where older devices might have had 500GB or even a terabyte worth of storage, your new MacBook Pro may only have 256GB in its place. The easy way out of this is to purchase some external hard drives to keep with your device, but sometimes, you don’t have the means or ability to head out and purchase on of those. If you absolutely have to keep your documents, videos, and other files on your device—or, even better, you have to share them with someone else online—the easiest way to do it is through zipping your files on MacOS.

Zipping, or compressing, a file makes it easy to save some space on your hard drive, and also makes it easy to share those documents and folders with someone through a file sharing service like Dropbox or Google Drive. Zipping your files can compress them down to a much smaller size, saving up to 80 percent of storage room while maintaining the original quality of the information once you’ve decompressed or unzipped your file. Even better, you can set privacy controls to your zip files, which allows you to control who can see the information and who can’t without having to worry about sending the file over the internet. Of course, this can be pretty confusing if you’ve never compressed as file before, so here’s the good news: it’s surprisingly easy to do, making file sending and other utilities easier than ever. Let’s take a look at how it’s done.

What does Zipping and Unzipping Mean?

At its core, zipping and unzipping files simply means using a utility inside of your Mac to compress a file or folder down to a much smaller size than previously used by the device, without losing any quality in the files you’re compressing on your computer. Zip itself refers to the file type of a compressed file, .zip, which is supported by both MacOS and Windows, along with other operating systems like Android. Though modern operating systems can view the contents of a zipped folder without having to unzip or uncompress the files inside, you typically need to uncompress the file before you can use any of the files on your machine. For most people, being able to view the files inside of a zipped file may be enough to not even have to uncompress the file.

So, when should and shouldn’t you zip a file? Typically, if you’re trying to send someone a file over the internet, through email or other means, and the file is too large to upload to the server, you’ll want to make sure you’ve compressed the file down in size. This will allow the service you’re using to easily send the file over the web, without having to worry about your recipient not being able to access the file. That said, thanks to cloud-based services that have far higher file size limits than what we’ve seen from email providers in the 2000s, it’s easier than ever to send and upload your work without having to compress it. Of course, there are benefits

Zip File Caution

We can’t explain zip files without also offering a word of warning revolving around the security of using and downloading zip files onto your computer. While there isn’t necessarily anything dangerous about zip files on their own, zip files can often be used for malicious practices, loaded with dangerous content by someone who is intending to cause harm to your computer. For the most part, someone sending you a zip file is no reason to be concerned, especially when it’s from someone you know or it contains files you know will be too large to send through normal email channels. Same goes for when you’re downloading files from certain sites; installers, for example, will often use zip files if there’s a lot to contain into one downloadable folder in order to save download time and bandwidth. Likewise, sites like Google Photos will automatically compress your files into a zip folder in order to save time when downloading more than a single photo at once.

However, if you download something that shouldn’t have to be a zip file from a source you aren’t familiar with, be sure to be cautious when proceeding with downloading and opening files. A safe bet is to open the zip file without extracting the content within, to preview what’s contained in the file. One of the worst types of attacks to use a zip file is called a zip bomb (pictured), which can hide thousands of terabytes of information inside a miniscule file that will cause your computer to crash and your hard drive to become unresponsive. If you recognize the information and content kept within the source, you’re free to proceed with extracting the zipped file. You can also run the file through a scan on your computer using antivirus software. It’s always better to err on the side of caution, so be careful when opening strange zip files.

How to Zip and Unzip files

Though computers running older versions of Windows used to need a third-party tool in order to zip and unzip files, computers running MacOS have had the option to compress and uncompress files for years built right into the operating system, making it easy to receive files from sources and to zip and unzip them as needed. The tool, called Archive Utility, has been around since MacOS X 10.3, making it widely available on every Mac sold over the past decade. So no matter which version of MacOS you’re running, it’s easy to gain access to this tool. Let’s take a look.

First, find the file or folder you want to zip. Both individual files and folders of files can be zipped, though if you’re sending a large amount of individual files, you’ll want to take a look at placing them into folder in order to compress. No matter whether you’re compressing a single file or a folder, the compression system with Archive Utility works the same. To open the compression menu, right-click on the file or folder inside Finder or on your desktop. MacBooks can use the two-finger click to register a right-click, and anyone use a mouse with a single-click button can activate a right-click by holding Ctrl on your keyboard while clicking with your mouse. From this menu, select “Compress ‘[File/Folder Name]'” in order to compress your file. Archive Utility will open, and you’ll be able to save the file or folder to the location of your choosing. Depending on the size of your file or folder, it may take some time to finish the compression step, though anyone with an SSD-enabled computer will see their speed increased exponentially.

zipfolder

To unzip your file or folder, or to unzip a file or folder sent to you over the web, is just as easy as compressing the document. Locate the .zip file in Finder, typically in your Downloads folder or wherever you save files to when downloading from the web. If you created the zip file personally, you’ll find it wherever you saved it in the last step in the creation process above. With zip files on MacOS, you can double click on the file to view the content inside, though you won’t be able to access the information until you’ve unzipped the file.

To do this, right-click on the zipped file or folder with your trackpad or mouse and scroll to “Open With.” Hover over the menu icon to open the submenu, which will give you a list of options you can use to open a compressed file. By default, this is set to be opened with Archive Utility, though there are a number of third-party apps available for MacOS that also allow zipped files to be unzipped with more options than included by default with Archive Utility. Once you’ve selected Archive Utility, the file should automatically be uncompressed and saved in the same location.

Archive Utility

How to Create a Password-Protected Zip File

Finally, we come to the final step in understanding how zip files work on MacOS. While compressing and uncompressing files on MacOS is an incredibly easy and simple thing to do, creating a password-protected zip file on your Mac takes a little more patience and a little more effort than simply right-clicking on a file. Though MacOS can create a password-protected compressed file naturally without the aid of an additional program or application, you’ll have to use Terminal on your Mac to enter commands manually into your computer. If you’ve never used Terminal before, this can seem terrifying or even impossible to do correctly, but rest assured, entering commands into your computer is a pretty simple task as long as you follow the guides laid out below. Alternatively, you can use third-party software like WinZip (which, despite the name, does have a Windows client) or Keka, an open-source alternative to WinZip, to place a password on your compressed files without having to use command lines. Regardless, here’s how to do each method.

Terminal

First, it’s important to note that our guide will be using the desktop as our directory inside of Terminal. If you’re new to using Terminal, make sure to move the file or folder you want to zip to the desktop; otherwise, follow along and set the directory to the location of your own file. Start by navigating to the Terminal application by either finding the utility inside of Finder under “Utilities”, or by pressing Command + Spacebar to active Spotlight search on your Mac and typing Terminal into the entry field. Terminal can also be launched by using the Launchpad view on your Mac. Once you’ve entered into Terminal, we need to set our directory to tell our Mac what to do with our device. As mentioned, we’ll be using the Desktop of our computer as our director, so we need to type the following without quotes: “cd Desktop“. Press enter to set your directory. If you’re using a directory like Documents, simply change the

Once you’ve entered your directory and you’ve made sure the file or folder you wish to zip and encrypt is in the proper location, enter the following command without quotes and without brackets, and with the words associated within the brackets substituted with your own information: “zip -e [zipped filename] [original filename]“.

So, for example, if your trying to compress a file with the name “example.txt,” your command will read: “zip -e example.zip example.txt“. Make sure to enter the file extension of your correspond file; here, the file extension is .txt. If you’re trying to zip and compress a folder, make sure that, instead of including the file extension at the end of your command, you include “/*” to signal to your Mac that it is a file you’ll be compressing. If the file you’re zipping has spaces in the file name, either eliminate the spaces beforehand by renaming the file or ensure to include a “/” after every word, while at the same time, retaining the space following the slash. Finally, make sure the zip file you’re creating matches the name of your original file or folder (ie, “example” and “example”), or else your Mac will fail to create the zip file.

Once you hit enter from this command, you’ll be prompted to enter a password into Terminal. You’ll notice that, though Terminal has a cursor, it appears that nothing is being entered into the field on your computer and the terminal isn’t moving. This is entirely normal and expected, and is treated as a privacy aspect of Terminal. Although it seems like nothing is being enter, Terminal is tracking which keys you enter. Since you can’t check your password to verify a lack of typos, be as careful as possible when typing out your password; a typo can make yur zip file inaccessible if you aren’t careful. Hit enter, then enter your password again to verify, and your zip file will be created, assuming you’ve followed the above steps closely.

Now, when you try to open your zipped file, you’ll be prompted with a password upon entry. You can test this out on your computer by trying to unarchive the file you just created on your desktop or other directory; you’ll be prompted with an entry field for your password that you can enter on command. This new zip file can be sent to anyone regardless of operating system; so long as their device supports zipping and unzipping files, they’ll be able to enter the password you share with them discreetly and access the content inside. Finally, it’s worth noting you can always use Terminal to compress your files and folders without encryption; simply remove the “-e” from the equation, which will tell the computer to simply make a zipped file from the original file or folder you designate.

WinZip

WinZip is one of the most popular utilities in the world for any operating system. Though technically considered shareware, WinZip does contain a free trial for anyone who uses the program non-commercially, meaning regular consumers are fine to use the application without having to pay for it so long as you put up with the warning that appears when you start the application (eventually, this may run out). WinZip is a solid program to use with your MacBook or iMac, especially if you constantly are zipping and unzipping files and want something with a little more power. WinZip can offer that, but perhaps even better when compared to some other applications, it can also offer an easier way to automatically zip files with passwords without having to use Terminal, making it easy to avoid having to enter long command lines of information.

If you don’t already have WinZip, you can download it from here. Once you have it installed and setup on your Mac—the installation process is simple and fairly to the point—make sure it’s open on your device. Drag your files or folders into the main view of WinZip’s project manager. In the Actions pane to the right-side of the list, check “Encrypt” from the list of available options on your device. Click on the + or ‘Add’ button in the top of the program, and select “Open from Finder.” Select options inside the Finder view, and enter the encryption password you wish to use for your compressed file. Click OK and close out of the Finder view, then click “Save as” in the Action panel to select a location on your computer for your zipped file. The zip file created will be password-protected, and you’ll be good to go once the file is saved.

Keka

The biggest problem with WinZip is, eventually, your free trial may run out, causing you to have to pay upwards of $30 just for an application that your computer can mostly handle on its own. That’s where open-source and freeware alternatives come in, and there isn’t a better option on the market today than Keka, a program that is generally held up as one of the best open-source file compressors on the market today. Though both MacOS and Windows 10 now have alternatives built-in that allow you to bypass having a third-party file compressor and extractor on your device, being able to easily set a password on your zip files and folders is what makes it such a great utility. Keka in particular is trusted around the world for offering a free zipping experience with all the bells and whistles you’ve come to expect, so without further ado, let’s take a look at how to make an encrypted file in Keka. Spoilers: it’s pretty similar to WinZip.

Keka is an incredibly lightweight utility on Mac that makes WinZip seem rather ancient and clunky by comparison. Once you’ve installed the application by downloading the .dmg file from their website here, simply select .zip from the top menu along the application, check the “Encrypt Files” option, then enter and re-enter your password for verification into the included boxes. If you wish, you can also create a .7z file archive, which features more powerful encryption tools and options while still allowing most devices to easily open the encrypted file types. No matter which version of compressed files you choose, once you’ve entered your password into both the initial and the repeat boxes, you can drag your files into the compress box and you’ll be able to save your final zipped file. It’s that easy. As with any other encryption-based compressor, you’ll be prompted with an entry field to enter your information into once you’ve double-clicked on the compressed file.

***

Of course, WinZip and Keka are by no means the only platforms out there for visually assigning encryption to a file or folder you’re looking to compress. In addition to those two software applications and the tools offered by MacOS by using Terminal, there are plenty of other third-party tools online to help you seal your private information for third-parties. It’s important to note that encrypting a .zip or .7z file doesn’t make it impervious to cracks, and to remember that email isn’t the most secure platform for sending information back and forth. That said, if you’re looking to at least give some sort of security measures to your private or semi-private information on the web, encrypting it behind a platform using compressed files can make it easy—and save you some space on your hard drive.

Posted by Heather on October 14, 2017

6 thoughts on “How to Password Protect a Zip file in MacOS”

Rosalea says:
Screenshots would have been much more helpful. Not everyone understands how to type in the target folder info.
Reply
Mark says:
Rosalea, you type in the target folder info by using the keys on your keyboard. What screenshot would make sense for that?

Thank you, HEATHER!

Reply
Gigi says:
I can’t type a password in the Terminal…there is a key icon and nothing I type gets entered…..grrrrrrr!
Reply
Spencer says:
That’s how it works. It doesn’t show you what you’re typing. Just type it like you would any other password.
Reply
binoop says:
For Zipping a folder with password
zip -er [archive] [folder]
eg: zip -er zippedFile.zip FolderToZip
zip -er ~/Desktop/zippedFile.zip/ ~/Documents/FolderToZip/

For Zipping a file with password
zip -e [archive] [file]
eg: zip -e zippedFile.zip FileToZip.txt
zip -e ~/Desktop/zippedFile.zip/ ~/Documents/FileToZip.doc

Reply
Jimmy says:
No spaces in target folder name
Reply
Jacob says:
Use quotation marks around the path if there is a space.
zip -e “~/Desktop/File With Space.zip/” ~/Documents/FileToZip.doc
adam says:
I used the correct file name got a message saying “zip warning: name not matched: target_folder1”
Reply
ew says:
before entering the command. pls enter directory of folder..

for example: ~cd/desktop/

or if your file is in a subfolder at desktop.. then: ~cd/desktop/[folder name]

then the utility will be in that folder and you can use the command..

Reply
Andrey says:
To protect folder you need to use slightly different command: “zip –er archive_name target_folder1″
Reply
Moradeyo says:
I tried to follow you instructions about encrypting a folder/file but all it does is create an empty zip file containing a string of files similar to the path of the target folder I chose. Any idea why this could be happening?
Reply
Moradeyo says:
plus the created zip file is not protected i.e. I was able to access it without entering a password
Reply
Moradeyo says:
Also, the created (empty) zip file was accessible without the password I supposedly assigned to protect it.
Reply

Leave a Reply

Your email address will not be published. Required fields are marked *