Skip to content

Instantly share code, notes, and snippets.

@retpolanne
Created September 12, 2025 19:55
Show Gist options
  • Select an option

  • Save retpolanne/72904e761fff864b4a170ebcb695b978 to your computer and use it in GitHub Desktop.

Select an option

Save retpolanne/72904e761fff864b4a170ebcb695b978 to your computer and use it in GitHub Desktop.
Apple Books export

Apple Books export

Apple does something weird with .epubs that you add to Apple Books. Here's how to recover them back after you import them.

Where do your books live

Your books reside here, but they aren't actually epubs.

~/Library/Mobile\ Documents/iCloud\~com\~apple\~iBooks/Documents

How to export them as actual epubs

It seems Apple unpacks them weirdly, so to export them as actual epubs, you need to do something like this [1] & [2]

# Copy the Apple version of the epub to somewhere
cp -r apple-epub-path.epub /tmp
# Enter the epub directory
cd /tmp/apple-epub-path.epub
# Generate an empty epub file
zip -X0 "$PWD/destination.epub" mimetype
# Add files to the empty epub file
zip -rDX9 "$PWD/destination.epub" * -x "*.DS_Store" -x mimetype

[1] https://www.mobileread.com/forums/showthread.php?t=55681

[2] https://www.mobileread.com/forums/showpost.php?p=4304758&postcount=146

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment