How To Zip A File On Mac Terminal

For those that appreciate simplicity or are newcomers to the MacOS Terminal, zipping a file might seem daunting. Thankfully, it’s not as complex as it seems! This tutorial aims to guide you on how to zip files on MacOS Terminal.

Using the Terminal

The Terminal is an interface that allows you to access the Unix part of macOS to run commands. Here is a step-by-step guide on how to zip a file using the Terminal:

  1. Press Command + Space to open Spotlight Search and type in ‘Terminal’ then press enter to open it.

  2. In the Terminal window, navigate to the directory containing the file you need to zip. You can use the “cd” command (without quotes) followed by the path of your directory to do this. For example:

                cd ~/Desktop/myfolder

    This command navigates to ‘myfolder’ which is located on the Desktop.

  3. To zip a file, use the “zip” command (without quotes) followed by the name of your new zip file (you can name it anything you want), and then the name of the file you need to zip. For example:

                zip mytextfile.txt

    This command will create a zip file named ‘’ from the ‘mytextfile.txt’.


Zipping files via the Terminal in MacOS is a quick, simple process once you know the appropriate commands. Not only does this method save time, but it also provides a deeper understanding of how your Mac works. With the newfound knowledge of how to zip files using the Terminal, you are now a step closer to mastering MacOS!