How to zip files on Mac


Someone once said you can never be too rich, or too thin; you might also add that you can never have too much storage space. One way to save space on your Mac is to compress (or ‘zip’) files and folders so they take up less room, and this is also a good idea if you plan to send them to someone else.

In this article we show how to zip a file on your Mac, how to unpack (or ‘unzip’) it, and how to password-protect the resultant zip or archive file so that only the intended recipient can view it. Keir Thomas contributed to this article.

How to zip a file on Mac

Turning a conventional file (whether picture, video, music file, document or other type) or folder into a compressed zip file is very easy on a Mac:

  1. Right-click (or Ctrl-click) the file or folder, and select ‘Compress [name]’.
  2. Wait for a moment (very large files or folders with lots of files may take a while), and a new .zip file will appear in the same location as the original file (unless you’ve chosen a different destination – see below). You’ll hear the system alert sound to indicate the process has completed.

How to zip files on Mac: Compress

That’s it! This .zip file can now be emailed to a friend or simply stored until needed. You can delete the original file if you wish, but you won’t be able to view or use the zipped file in its present form: you’ll need to unzip it first.

Compressing multiple files

To compress several files and/or folders, create a new folder (Shift + Cmd + N) within Finder or on the desktop and name it whatever you want the zip to be called. Drag and drop the files you want to be in the zip, but hold down Alt before releasing the mouse button so the files are copied there. Then hold down Ctrl and click the folder, selecting the Compress option on the menu. Once zipping has completed, drag the folder you created to the Trash.

Note that Windows users decompressing your zip will also see ‘dot files’ – files and folders whose filenames are preceded by dots or sometimes underscores (such as ‘.DS_Store’ or ‘_MACOSX’). These are Mac system files and can be ignored. You can use a free app such as FolderWasher to remove dot files before creating the zip.

How to make zip files save somewhere else

You can change the destination of your compressed files by opening the app that does the compression. It’s called Archive Utility, and can be found via a Spotlight search.

Open Archive Utility, then click the Archive Utility dropdown menu at the top of the screen and select Preferences. Click the menu labelled ‘Save archive’, and select ‘into’, and then choose a new destination. (By default it will save the zipped file in the same place as the original file.)

How to open (or ‘unzip’) a zip file on Mac

This is even easier than the last bit. You just have to double-click a zip file and it will open itself. The zip file will still be in its original location, but an unzipped copy will appear alongside it.

Should you need to decompress an archive that’s not a zip – a .rar file, for example – then install The Unarchiver. This is free from the App Store and works in exactly the same way as the built-in zip tool – simply double-click the archive file and the files and folders will automatically be extracted to the same location.

To preview the contents of archives using macOS’s Quick Look feature, install the free BetterZip Quick Look Generator.

Automatically extract ‘safe’ files from zips

Some web browsers unzip what they consider to be safe files automatically when you download them (in Safari’s case safe files include image files such as Jpeg, PDFs and movies); this may be something you’d rather not happen.

If you’re in Safari, go to the Safari dropdown menu, then Preferences, and select the General tab. Then either tick or untick the option ‘Open “safe” files after downloading’.

How to zip files on Mac: Unzip files automatically

How to password-protect zip files

At last, a challenge! This is a little more difficult – but well worth the trouble if you’re going to be sending a sensitive file or document across an unsecured messaging system. We can encrypt the zip file so that anyone – on Mac or PC – will have to enter the password to use or view the file or folder.

In fact the process really isn’t scary: you just need to spend a few moments in Terminal. The command ‘-e’ will tell Terminal to encrypt the zip file.

Open Terminal (it’s in Applications > Utilities, or you can use Spotlight to search for it), and type in the following. (Type Enter after each line.)

We will pretend the file to be zipped is called macworld.jpg and located on the desktop, but you’ll need to change the relevant bits so they’re right for you. If it’s a folder rather than a file we’ll need to use slightly different code so see the section on folders below.

cd Desktop

zip -e macworld.zip macworld.jpg

At this point Terminal will ask you to enter a password. As you type this in, it will seem like nothing is appearing, but it’s designed this way so don’t worry – just press Enter once you’re finished, and then repeat when it asks you to verify the password.

Whatever password you enter will need to be entered again to uncompress the zip file.

How to zip files on Mac: Terminal

Let’s see that code again, but this time we’ll use square brackets to indicate the bits you should change. Don’t include the square brackets!

cd [location of file]

zip -e [new_filename].zip [old_filename].[filetype extension]

Note that the zip file can have the same filename as the original (except with a .zip extension), or a different one.

Warning: Spaces in file or folder names!

If at all possible, we would recommend renaming the file or folder you’re compressing so that it doesn’t have any spaces in the name, because this plays havoc with Terminal. (You could replace the spaces with underscores, which looks reasonably neat.) If you absolutely must include spaces, you’ll need to modify the code so that the spaces are each preceded by a (you should still include the space).

So let’s say we changed the name of our original file from ‘macworld.jpg’ to ‘mac world.jpg’.Now, instead of

zip -e macworld.zip macworld.jpg

we would type

zip -e mac world.zip mac world.jpg

What if it’s a folder, rather than a file?

This time, instead of a file extension, you would use the ‘-er’ command instead of ‘-e’. This tells Terminal to compress the contents of the folder.

If we imagine that we’re compressing a folder called macworld, we would type:

zip -er macworld.zip macworld

How to open a password-protected zip file

You (or the recipient of your encrypted zip file) do not need to worry about Terminal – just double-click the zip file as usual and then enter the password when prompted. It will unzip in the normal way.

Alternative zipping tools

Most Mac users have been happily using zips for years, but a few people still use StuffIt, which remains a powerful application able to do things the built-in Mac zip tool can’t, such as create a wider variety of archive formats.

To use it, just drag and drop the file or folder onto the Zip tile in the StuffIt interface. The archive will be created instantly.

Source

Tags: