Mac OSX: Adding to a zip file

Zipping files in Mac OSX is easy:

  1. select the file/s;
  2. right-click or ctrl+click;
  3. choose “Compress…”.

Adding files to an existing zip file is less intuitive. There are ways to deal with this: use Stuffit; use some other commercial program; or even, as one thread I found suggested:

  1. unzip the existing file;
  2. open the new folder;
  3. add your new files; 
  4. delete the old file;
  5. re-compress the folder;
  6. rename the new file.

Um, yeah? Right? No. Wrong, definitely wrong.

So instead open terminal, use cd to navigate to the right folder then type:

zip /path/to/ file1 file2 file3

and press Enter

To add an entire directory and all subdirectories navigate as above then type:

zip /path/to/ * -r -x *.DS_Store 

Note the file exclusion switch at the end, after all, you don’t need your DS_Store files.

That’s it, enjoy.