How to Zip Files or Folders on Mac Terminal

Nicholas Russell
By Nicholas Russell 14 Min Read
14 Min Read

Have you ever needed to make a zip file? Chances are, you have. Zip files are like magic bags where you can put all sorts of files and folders to make them easier to handle and share. They’re super handy and work on almost any device or computer. Now, if you’re using a Mac, you might think you need some special program to create zip files. But guess what? You can actually make them right from your Mac’s Terminal. Sounds a bit techy, right? Don’t worry, it’s simpler than it sounds!

You just need a simple command:

zip -r <name-for-your-zip>.zip <files-or-folders-you-want-to-zip>

That’s your magic spell! Stick with me, and I’ll walk you through how to use this command. Plus, I’ll share some neat tricks to make it even easier and explain why zip files can be such lifesavers in many situations. Let’s dive in!

What is a zip file?

Ever heard of a zip file and wondered what it is? Think of a zip file like a digital storage box. It’s a single file, usually ending in “.zip,” that can hold one or several files and folders. But here’s the cool part: it squishes these files down to a smaller size than the original ones. This shrinking act is called compression, and it’s super handy because it saves space on your computer or device.

You might also hear people call zip files “archive files” or “compressed files.” That’s because the zip format is a popular way to pack up and store files you’re not using right now. By zipping them, you can keep them together in one spot without eating up too much storage space. It’s like having a neat, compact box where you can store things away until you need them again!

Create a zip file using the zip command

Alright, let’s get our hands dirty and actually make a zip file! Don’t worry, it’s easy. First, you need to know where the stuff (files and folders) you want to zip is located on your Mac. Got it? Great! Now, let’s use the zip command I mentioned earlier.

Imagine you have three files – mytest.txt, mytest2.txt, mytest3.txt, and a folder named testdir. You’re already in the folder where these files live. We’re going to put all of these into a new zip file named

Here’s the magic command:

zip -r mytest.txt mytest2.txt mytest3.txt testdir

In this command, zip is like saying “Hey computer, let’s make a zip file.” The -r part is important – it tells your computer to look inside any folders and grab all the files inside them too. is what we’re naming our new zip file. After that, we list all the files and folders we want to pack into this zip file.

Once you press Enter after typing this command, your Mac will work its magic, and voilà! You’ll find in the same folder where you started. It’s like packing a suitcase – everything you listed is now neatly packed into your zip file suitcase! 🧳✨

Zip File Tips

Making zip files can be super easy, but what if you have a ton of files, like 20, 50, or even 100? Typing out each file name would be a nightmare, right? Don’t worry, I’ve got some cool tips to make zipping a breeze, even when dealing with loads of files. Plus, I’ll share a couple of neat things you can do with zip files, like adding a password for extra security.

Put your Files in a Directory

Here’s a life-saving tip: when you’re dealing with lots of files, first put them all into one new folder. I like to call this a ‘staging area.’ It’s like gathering all your stuff in one room before packing for a trip. This way, you can make sure you have everything you need before you start zipping.

When it’s time to zip, you just need to give the name of this folder in your zip command. It keeps everything neat and tidy. For example, let’s say you named your folder ‘Archive.’ Your zip command will look like this:

zip -r Archive

That’s it! With this one command, you create a zip file named ‘’ that contains everything in your ‘Archive’ folder. No more typing out a million file names!

When you unzip this file later, everything will come out neatly in the ‘Archive’ folder, instead of spilling all over the place. It’s like having a well-organized suitcase that keeps everything in order.

Use Wildcards to specify files

Wildcards are like your magic wands in the world of file management. They help you select bunches of files without typing each name. For instance, if you want to zip all text files, just use *.txt in your command. It’s like saying, “Hey, grab all the files ending in .txt!”

Want to zip up different types of files together, like text and Word documents? No problem! Just do this:

zip -R *.txt *.doc

The -R (with a capital R) is your super tool here. It tells your Mac to look in all folders for files ending in .txt or .doc and pack them into

And if you want to zip everything in your current folder, just use *:

Password Protect your Zip file

Want to add a secret code to your zip file? You can! Use the -e parameter to create a password-protected zip file. This is perfect for when you’re sending sensitive or personal info. Just remember your password, or you won’t be able to open the zip file again.

Verify your Zip file

Curious about what’s in your zip file? You can check it out without opening it. Just use the -sf parameter. It’s like having X-ray vision for your zip files! For example:

zip -sf

will show you what’s inside

Other Zip parameters and commands

There’s a whole world of commands and parameters in the zip universe. Type zip on its own to see the basics. For a deeper dive, type zip -h2. And for the full encyclopedia of zip knowledge, man zip is your go-to command.

These tips will help you zip files like a tech wizard, whether you’re dealing with a handful or a whole mountain of files.

Why use a zip file?

Zip files are not just about squishing files to make them smaller. They’re like your digital Swiss Army knife, super useful in many ways. Let’s dive into why zip files are such a big deal.


The packaging ability of zip files is like having a digital suitcase. You can pack a bunch of different files and folders into one neat file. This makes a lot of things way easier.

Installation Packages

Ever downloaded a program for your computer? Those are often zip files. They bundle all the stuff needed to set up the program in one tidy package.


Imagine having to carry a bunch of books individually versus putting them in a backpack. That’s what zip files do for digital files. Whether you’re uploading, downloading, emailing, or transferring files to a flash drive, having just one file to deal with is a lifesaver.

Backup and Archiving

When you back up files or store them away (archiving), it’s way more convenient to have them all zipped up in one file. This makes moving them to places like the cloud or a USB drive super easy.


Now, let’s talk about the magic trick called compression. This is where zip files really shine.

Installation Packages

By compressing the files needed for software installation, zip files make these packages smaller. This means less space is taken up on your computer or device, leaving more room for the actual application. It’s like getting a flat-packed furniture set instead of a fully assembled one – it just takes up less space.


Smaller files move faster. When you’re sending or receiving files over the internet, email, or any network connection, having them compressed means they travel quicker. It’s like sending a postcard instead of a large package.

Backup and Archiving

Storing backups or old files can quickly fill up your hard drive. Compression reduces the size of these files, so they take up less room. This is especially handy if you’re tight on storage space or if you’re storing a lot of data over time.


And there you have it! Zip files are like the superheroes of the digital world. They’re super important because they let you bundle up a bunch of files into one neat package and shrink them down to save precious storage space. 🦸‍♂️💼

We dove into the world of zipping files and folders using the Mac Terminal, exploring different commands and handy tricks. Whether you’re dealing with a couple of documents or a mountain of files, the zip command has got your back.

I hope this guide turns you into a zip file pro, ready to tackle any file management challenge that comes your way. Remember, zip files are your friends in the digital universe, making life easier, more organized, and way more efficient.

If you’ve got any questions or just want to share your zip file adventures, I’m all ears! Your feedback is always welcome. Happy zipping, and here’s to keeping your digital world neat and tidy! 🌟📁🚀


What is a Zip File?

A zip file is a digital container that holds one or more files and directories. It compresses these files, making them smaller in size, which saves storage space. A zip file typically has a “.zip” extension.

How Do I Create a Zip File on a Mac?

On a Mac, you can create a zip file using the Terminal. Use the command zip -r <> <files/folders> to zip files and folders into a single file. For example, zip -r myfolder would create a zip file named ‘’ containing ‘myfolder’.

Can I Zip Multiple Types of Files Together?

Yes, you can zip different types of files together. Use wildcards in the Terminal command, like *.txt or *.doc, to select multiple files of a certain type. For example, zip -r *.txt *.doc would zip all text and Word documents in the current directory.

Is It Possible to Password-Protect a Zip File?

Yes, you can password-protect a zip file for added security. Use the -e parameter in the zip command to encrypt the file with a password. Remember, if you forget the password, you won’t be able to access the contents of the zip file.

How Can I Check What’s Inside a Zip File Without Unzipping It?

To view the contents of a zip file without unzipping it, use the -sf parameter. For example, zip -sf will list the contents of ‘’.

Why Are Zip Files Useful for Backing Up and Archiving?

Zip files are great for backing up and archiving because they allow you to consolidate multiple files into one single file, making them easier to move and store. The compression also reduces their size, saving storage space on backups and archives.

Share This Article
Leave a comment

Leave a Reply

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