Bulletproof EPUB zipping in a single pass (or, How to zip an EPUB from the Terminal in OS X sans .DS_Store files)
I wrote a blogpost recently on how to remove .DS_Store files that erroneously find their way into EPUBs. I have since found a proper solution to my woes and have what seems to be a bulletproof way of zipping EPUBs without the need for double-zipping or later removal of .DS_Store files. It places the mimetype where it should be (at the top of the hierarchy) and leaves the .DS_Store files outside the archive. So without any further ado here is the magical line of code to be run in Terminal from within the folder containing your book files that you want to compress into an EPUB: zip -Xr9D book.epub mimetype META-INF OEBPS -x *.DS_Store Note: All the files within the folders will be incorporated. If future EPUB specs change what is incorporated in the top level folder, then additional files and folders will need to be added after OEBPS or in their specific place in the order should they have one (files after the -x are the ones to be excluded). Update: Thanks to elmimmo (see co