I followed this tutorial to create an epub file. The mimetype file only contains application/epub+zip and should not be compressed. However, the zip commands that were recommended to achieve the non-compression of mimetype, i. e.

 zip -0Xq  ebook.epub mimetype
 zip -Xr9Dq ebook.epub *

...produce the following error when I run epubcheck:

ERROR: ebook.epub/mimetype: Mimetype file should contain only the string "application/epub+zip".

So I tried two other combinations of zip options, but the error stays the same.

 zip -X ebook.epub mimetype 
 zip -rg ebook.epub META-INF 
 zip -rg ebook.epub OEBPS

 zip -X0 ebook.epub mimetype
 zip -rX9 ebook.epub * -x mimetype

However, Calibre will open any of these Ebooks without any problems.

The content of my mimetype file is correct, so that it must be a problem with the zip commands. Or could this a bug of epubcheck?


You need to remove the character \n and \r from the mimetype file using tr command of linux as follows:

tr -d '\n'< mimetype >mimetype.1 tr -d '\r'< mimetype.1 >mimetype.2 rm mimetype mimetype.1 mv mimetype.2 mimetype

And then you will have to add the file mimetype to the epub file using the following command:

zip -0Xq book.epub mimetype

Then you need to add remaining files to epub files as follows:

zip -Xr9Dq book.epub * -x mimetype -x book.epub

Then just validate it using online epub validator such as http://validator.idpf.org/ and you will get NO ERROR regarding mimetype.

I hope this helps to you.

  • 2
    It is not necessary to modify the mimetype file. You can create it directly without the newline: echo -n application/epub+zip >mimetype. – pabouk Nov 15 '13 at 12:22
  • I tried it with the echo command and your zip commands and epubcheck does not bring this error message anymore. Thanks! – Suzana Nov 16 '13 at 19:35

open the minetype file in dreamweaver or any text editing software and delete any spaces after the line that says 'application/epub+zip'. Make sure there isn't any returns as well.

That should work


I'm using a Mac, running "ePub Zip/Unzip 3.0" (an Applescript that contains the correct zip commands, etc.) and I got this error too.

It turns out that both BBEdit and TextWrangler have a Preferences setting that automatically adds an additional line-break when you save. I unchecked that preference, and no more error.

Check your text editor to see if it has such a preference, and turn it off, if you can. (In BBEdit, it's called "Ensure file ends with line break" under the "Text Files" Preference.)



Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.