How to Password Protect a Zip File in MacOS

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 surprising 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, though the cost of SSD has been dropping every year.

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 the 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 zipped files.

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 to 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 minuscule 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 number 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 it. 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.

  1. Start by navigating to Terminal 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”.
  2. Now you need to set your directory to where you’ll be working with files. Since we’ll be working with the desktop, we’ll set that as our directory by typing in the command cd Desktop/.
  3. When you hit Enter, you will see a change in the command prompt line, and your directory will have changed.
  4. Once you have entered your directory and made sure the file or folder you wish to zip and password-protect are in the proper location, enter the following command without quotes and without brackets. zip -er [zip filename] [original filename]. (The filenames MUST match)
  5. Once you hit Enter on this command you’ll be prompted to enter a password. Type what password you want to use. As you type you will not see any characters appear on your screen, but that is normal.

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 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.

As you type your password, 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 feature 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 the 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 set up 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 at 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 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.

If you liked this article, you might find other TechJunkie how-to articles useful, including How to

If you have any suggestions for zipping and unzipping files or have some alternative suggestions, please leave us a comment below!

Disclaimer: Some pages on this site may include an affiliate link. This does not effect our editorial in any way.