6

How to Password Protect a Zip File in MacOS

Posted by Heather on November 30, 2018
zip folder

Over the past five years, Apple has switched from using disk-based hard drives to SSDs (solid-state drives) on almost every computer model they sell. From the MacBook Air and 12″ MacBook, to the newest generation of MacBook Pros, even up to their iMac and Mac Pro line of desktop computers, Apple has decided that the best choice for storage is SSDs.

Flash-based SSDs provide better, faster performance and long lifespans than disk-based hard drives, as well as near-instant computer startups, minimal application launch times, and a slimmer profile. SSDs are clearly the future of computing storage, and it’s not surprise Apple has discontinued traditional or hybrid drives for their computers.

But there is a trade-off to the benefits of SSDs: GB for GB, they’re more expensive than HDDs. Generally, you can expect to pay twice as much for the same amount of storage. Instead of raising prices, manufacturers like Apple have simple cut storage capacity. 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 conundrum is to purchase a few external hard drives to keep with your device (perhaps an Apple-made 2TB Time Capsule). but sometimes, you don’t have the means or ability to head out and purchase one of those. If you absolutely have to keep your documents, videos, and other files on your device – or, even more likely, 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 such as 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 the file has been decompressed.

Even better, you can set privacy controls to your zip files, which allows you to control who can see the information and who cannot without having to worry about sending the file over the internet. Of course, this can be pretty confusing if you’ve never compressed a file before, so let’s take a look at how it’s done.

What Does Zipping and Unzipping Mean?

“Zipping” a file simply means using a utility on your Mac to compress a file or folder down to a much smaller size, without losing any quality in the file or folder. “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 such as Android. Though modern operating systems can view the contents of a zipped folder without having to unzip or decompress the files inside, you typically need to decompress the file before you can use any of the files on your machine.

So, when should and shouldn’t you zip a file? Typically, if you are 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 will want to make sure you have 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 those available 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 still benefits to zipping files, such as reduced data usage if your internet is limited, and faster upload if you have a poor internet connection.

Use Caution When Opening Zip Files

We cannot explain zip files without also offering a word of warning regarding the security of using and downloading zip files onto your computer. While there is not anything inherently dangerous about zip files on their own, they can often be used for malicious practices, loaded with dangerous content by someone who intends to cause harm to your computer.

For the most part, receiving a zip file from someone you know or that contains files you know would be too large to send through normal email channels is completely normal. The same applies for downloading files from most websites; installers, for example, will often use zip files if there is 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.

However, if you download something that should not have to be a zip file or that is from a source you are not familiar with, be cautious. A safe bet is to open the zip file without extracting the content within, in order to preview what is contained in the file (for information on how to do so, see below).

One of the worst types of zip file attacks is called a zip bomb (pictured), which can hide thousands of terabytes of information inside a miniscule file. A zip bomb will cause your computer to crash and your hard drive to become unresponsive. If you recognize the information and content within the source, you are free to proceed with extracting the zipped file. You can also run the file through your antivirus software.

How to Zip Files and Folders

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 decompress files for years built right into the operating system, making it easy to zip and unzip files as needed. The tool, 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 are running, it’s easy to gain access to and use this tool.

First, find the file or folder you want to zip. Both individual files and folders full of files can be zipped, though if you are sending a large amount of individual files, you’ll want to place them into a single folder in order to compress. No matter whether you are 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. From this menu, select “Compress ‘[File/Folder Name]'” in order to compress your file. Depending on the size of your file or folder, it may take some time to finish the compression step. For small files, the compression will occur almost immediately, and you will see a new file in the same directory as the unzipped file. The new file will have a “.zip” extension.

zipfolder

To make sure it worked – and to get a sense of how powerful zipping can be – select both the old and new files and press “Cmd + I.” Alternatively, right-click each file and press “Get Info.” In the pop-ups that appear, compare the number under “Size.” The compressed .zip file should be considerably smaller than the original file size.

How to Unzip Files and Folders

Unzipping your file or folder, or unzipping a file or folder sent to you over the web, is just as easy as compressing the document. Locate the .zip file in Finder; it will typically be 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 the original file is located.

To unzip the file, just double-click. A new, unzipped file will appear in the same folder or directory as the zipped file. If double-clicking does not work, right-click on the zipped file or folder and scroll to “Open With.” If Archive Utility appears, click it, and the file will be unzipped. If it does not, click “Other….” In the search bar, type “Archive Utility.” When it appears, click it and click “Open.”

Archive Utility

How to Create a Password-Protected Zip File

While compressing and decompressing files on MacOS is incredibly easy, creating a password-protected zip file on your Mac takes a little more patience and effort than simply right-clicking on a file. Though MacOS can create a password-protected compressed file without the aid of an additional program or application, you will have to use Terminal on your Mac to enter commands manually into your computer.

If you have never used Terminal before, it can seem terrifying or even impossible to do correctly. Rest assured, though – entering commands into your computer is a pretty simple task as long as you follow the instructions laid out below. Alternatively, you can use third-party software such as WinZip (which, despite the name, does have a Mac version) or Keka, an open-source alternative to WinZip, to place a password on your compressed files without having to use the command line.

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 “Cmd + Space bar” to activate Spotlight search on your Mac and then typing “Terminal.”

Once you’ve opened Terminal, you need to set your directory to tell your Mac where you will be working with files. As mentioned, we’ll be using the desktop of our computer as our directory, so we need to type the following (without quotes): “cd Desktop“. Press enter to set your directory.

Once you have entered your directory and made sure the file or folder you wish to zip and password-protect is in the proper location, enter the following command without quotes and without brackets. Fill the brackets in with your own information: “zip -e [zipped filename] [original filename]“.

So, for example, if you are 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 corresponding file; here, the file extension is .txt. If you are trying to zip 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 folder you’ll be compressing.

If the file you are zipping has spaces in the file name, either eliminate the spaces beforehand by renaming the file, surround the file name with quotes, or include a “/” after every word, while retaining the space following the slash. Finally, make sure the zip file you are creating matches the name of your original file or folder (e.g., “example” and “example”), or else your Mac will fail to create the zip file.

Once you hit enter from this command, you will be prompted to enter a password into Terminal. You will notice that even though Terminal has a cursor, it appears that nothing is being entered into the field on your computer and the terminal is not moving. This is entirely normal and expected, and is treated as a privacy aspect of Terminal. Although it seems like nothing is being entered, Terminal is tracking which keys you enter.

Since you cannot check your password to verify a lack of typos, be as careful as possible when typing it out; a typo can render your zip file inaccessible. Hit enter, then enter your password again to verify. If you’ve carefully followed the steps above, your password-protected zip file will have been created.

Now, when you try to open your zipped file, you’ll be prompted to enter a password. You can test this out by trying to unzip the file you just created; you’ll be prompted with an entry field for your password.

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 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 command, which will tell the computer to simply make a zipped file from the original file or folder you designate.

Previewing Files in Terminal

Now that you know how to use Terminal, you can check the contents of a zip file without opening it. As above, use Terminal to navigate to the folder where your zip file is. Then type “zipinfo [File Name]” and press enter. The resulting dialog will show you the files inside the zip file, when they were created, their original file names, and their original size. This information can be helpful in determining whether or not it is safe to open a zip file.

Alternative Zip Applications

WinZip

WinZip is one of the most popular utilities in the world for zipping and unzipping files. Versions are available for most operating systems. Though technically considered shareware, WinZip does contain a free trial for anyone who uses the program non-commercially, meaning regular consumers can use the application without paying for it so long as they put up with the warning that appears when they open the application.

WinZip is a solid program to use with your MacBook or iMac, especially if you are constantly 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 also offers 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 do not already have WinZip, you can download it here. Once you have it installed and setup on your Mac – the installation process is simple – make sure it is 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-hand 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 that eventually, your free trial will run out. Then you will have to pay upwards of $30 just for an application whose functionality your computer can mostly handle on its own. That’s where open-source and freeware alternatives come in. There isn’t a better option on the market today than Keka. 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 Keka such a great utility.

Keka is an incredibly lightweight utility on Mac that makes WinZip seem ancient and clunky by comparison. Once you have installed the application by downloading the installer from their website, simply select .zip from the top menu in 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 once you’ve double-clicked on the compressed file.

Alternative Zipping Software

Of course, WinZip and Keka are not the only platforms available for with an interface for password-protecting a compressed file or folder. 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 want to at least give some sort of security measures to your private or semi-private information on the web, creating a password-protected compressed file is an easy way to do so – and it will save you some space on your hard drive.

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 *