How to Recover iBooks Samples (Nerdily)

I use my iBooks sample queue as a form of future cultural memory. In the past couple years, I’ve collected nearly 75 samples. Who knows? I might read them someday.

I recently discovered that iBooks samples disappear when an iDevice is restored from backup. This was not a happy discovery. It precipitated much command-line nerdery in an attempt to recover.

Luckily, there’s a straightforward (albeit nerdy) solution.

First, extract a recent iTunes backup. I used Super Crazy Awesome’s iOS Backup Extractor — it works, and it might not even contain malware. Once you’ve identified the backup you’d like to use, navigate to com.apple.iBooks and extract its contents.

Now pop open Terminal.app. Find the iBooks_vXXX.sqlite file in the extracted directory structure and open it with sqlite3. You can get the authors and titles of all sample books with this simple SQL query:

select ZBOOKAUTHOR, ZBOOKTITLE from ZBKBOOKINFO where ZSAMPLECONTENT=1;

That’s all it takes. Future cultural memory: restored.