Convert cheap O’Reilly iPhone App Books to .epub

If you own an iPhone or iPod touch, you may have noticed that O’Reilly publishes a lot of its books as cheap iPhone applications:

These book applications go for a couple of bucks, which is very cheap compared to buying them through O’Reilly itself in their digital editions (often $30 or more). The drawback, naturally, is that they are just iPhone applications and you have to read them on the tiny iPhone or iPod screen. You can read them on the iPad, but they look very poor because of the pixel doubling. If you want to read these books on other devices, like a Kindle or iRex Digital Reader you’re out of luck.

Or so I thought.

Just by accident I came across the O’Reilly [eBook “tips and tricks” page](, which essentially tells you how to extract an HTML version of the book out of the iPhone application. Then you can also read the HTML version on your desktop. That’s nice, but not ideal. What I want is to extract an [epub]( version of the book, so I can read it on the iPad using iBooks, or on any other eBook reader. Luckily, it turns out you can, and it’s not even that hard.

So, even if you do not own an iPhone or iPod touch, there is a cheap way to get digital versions of O’Reilly books this way. Just follow my lead.

**Step 1: Buy an O’Reilly iPhone App Book** 
Simply search for the title in iTunes or search for “O’Reilly” to get the complete list.

**Step 2: Find the application on your hard drive** 
Simply right-click on the app in your application list in iTunes, and choose “Show in Finder” (or whatever the Windows equivalent is):

**Step 3: Make a copy of the file (ending with .ipa) to some temporary directory**

**Step 4: Rename the file to a .zip file and unzip it** 
Rename your file from `something.ipa` to `` and then double-click it to extract it in-place.

This will result in a directory being created next to it:

**Step 5: Find the book application inside** 
Navigate into the resulting directory. Inside it you will find a `Payload` directory, containing the application. If you’re on windows you can probably simply double-click it to go in, on Mac you have to right-click it and choose “Show package contents”:

**Step 6: Zip the contents of the `book` directory** 
Inside the `.app` you will find a `book` directory, go in there. Then, select all files and compress them into a zip file:

**Step 7: Rename the resulting zip file to `.epub`** 
The compressing will result in a `.zip` file, rename it to `.epub`.

**Step 8: Done!** 
You can now import (simply drag and drop) this `.epub` file into iTunes, for instance, to synchronize it with your iPad.

And off you go!