Stephen’s blogs

Creating e-books for the Apple iBookStore

I am creating some e-books for a client and here I share some of my journey.

Creating your masterpiece

What is an e-book?

An e-book is simply a digital version of a book that can be read on a computer or mobile device. There are a number of different formats (Apple's iBooks, Amazon's Kindle, etc.) as well as a lot of companies who use PDF (Portable Document Format) that is readable on most browsers or by Adobe Reader.

I am talking here about e-books for Apple's iBookStore that are stored in the .epub format.

EPUB Format

The .epub format is an open standard for e-books and is simply a (zipped) collection of XHTML files (typically one for each chapter), some images, a stylesheet and some 'manifest' files to describe the contents and sequence.

What tools to use

I created my first e-books - editing the XHTML files and building the manifest files - by hand. It is the long way round, but at the end you know that your publication is valid at every level.

I looked, on a number of occasions, for some eBook tools but found that most e-book creation software is a) expensive, b) has a high learning curve or c) mangles the underlying XHTML and CSS data. Some manage to do all three.

Now that Apple’s pages allows you to create an EPUB file (File / Export) I thought would be an easy-peasy process, but checking the epub internals shows some pretty messy output. Revisiting the excellent article that got me started (Creating eBooks: An ePub Tutorial) led me to an application called Sigil ("a WYSIWYG epub editor" ).

Sigil seems to provide just the right level of hands on coding and WYSIWYG views and has the tools for creating table of contents, validation, and publishing, making the rest of this blog redundant for all except anyone still doing things the hard way.


ThreePress provide an on-line epub validator ( but for regular use you should download ePubChecker.

Creating the Epub File

The .epub file is basically a ZIP archive of files. The mimetype file must be the correct length and must come before the other files. On the Mac you also need to exclude the .ds_store file.

I found a useful little app called ePub Zip (version 1.0.2) which zips the folder without any fuss.

I recently had problems using the following zips, even though they worked back in 2010

zip -X0 mysample.epub mimetype
zip -rDX9 mysample.epub * -x "*.DS_Store" -x mimetype

This is the one I used back in 2010:
zip -Xr9D mysample.epub mimetype * -x *.DS_Store

  • -X: Exclude extra file attributes
  • -r: Recurse into directories
  • -9: Better compression
  • -D: Don’t list directories separately
  • -x .DS_Store: Exclude Mac hidden file

Top of Page