This is the easiest way I found to combine two ZIP files – or even multiple ZIPs – into one «Master ZIP-file» using macOS. It’s not super intuitive as it involves the Terminal.app, but once the basic principle is understood, it should be straightforward.
Installation of a pre-requisite required
Below documented Terminal commands require a command line program which comes bundled in the libzip
-library which hence needs to be installed via homebrew first:
brew install libzip
Merge two ZIP files into one
Once you have the ZIP files at hands in Finder, continue as follows:
- Open the
Terminal.app
(from Applications » Utilities,⌘CMD
+⇧Shift
+U
in Finder) - Type the following command, then drag’n’drop the ZIP files into the Terminal window
(this will add their file paths automatically):
zipmerge -iS /path/to/existing/Masterfile.zip /path/to/other/ZIP.zip
- Press
↵Return
to merge the ZIP-files!
The command’s option -i
asks before overwriting existing files, -S
prevents overwriting identical files
Merge multiple ZIP files into one
In order to merge more than one ZIP file into an existing target ZIP, the same approach and command can be used – but any number of additional ZIP file paths are added at the end:
zipmerge -iS /path/to/Masterfile.zip /path/to/zip1.zip /path/to/zip2.zip …
Creating new ZIP files using the macOS Terminal
Contrary to merging existing ZIP files, the macOS Terminal can also create new ZIP files containing folders and files.
zsh: command not found: zipmerge
@Raro install it using homebrew in the Terminal.app as part of
libzip
: https://formulae.brew.sh/formula/libzip#defaultHow did you get zipmerge to work on your Mac? I tried building the package from GitHub but I don’t know where to put the resulting library so that terminal can find the command.
@Rob that was a very good and tricky question – but I figured it out after some reverse engineering: turns out I installed
libzip
via homebrew on my macOS at one point, which comes bundled withzipmerge
.