Pages has an File > Export To > ePub... option that I'm using to manually convert a Word document (which Pages can open directly) to ePub format.

I'm basically looking for the equivalent of:

/Applications/calibre.app/Contents/MacOS/ebook-convert mybook.docx mybook.epub

For completeness, I want to use Pages instead of Calibre because it does something 'smarter' with one aspect of arabic text that I need: it tags all arabic blocks with dir="rtl".

  • I'm going to hazard a guess that AppleScript will have better luck here than a straight Bash script, Apple doesn't have great documentation concerning command line switches. Jul 20, 2015 at 11:19
  • @agentroadkill can I invoke AppleScript from the command line? That would be just as good for my use case if so. If you know how to do this with AppleScript that works for me. Jul 20, 2015 at 12:21
  • This goes through using menu items with AppleScript pretty well. You'll also want to looks at passing command-line args to AppleScript Jul 20, 2015 at 12:44

1 Answer 1


If you're not married to using Pages and are familiar with the Terminal, you can use Calibre (free and open source) rather easily to do this using their command line interface through the terminal:

ebook-convert myfile.docx myfile.epub

The only slight challenge is finding the ebook-convert script after installing Calibre; typically it's here:

  • The OP mentioned in his question, that he wants to use Pages instead of calibre!
    – klanomath
    Jan 7, 2017 at 23:56
  • Ah right. Didn't notice that specific explanation. Well, hopefully this is useful to other people that don't have that specific constraint, such as myself when I stumbled upon this.
    – ijoseph
    Jan 8, 2017 at 1:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .