MacOS – How to use time machine to recover a deleted pdf in iBooks

bookshigh sierramacostime-machine

I just accidentally deleted a pdf in iBooks on my MacBook, and I'm trying to use time machine to recover it. I learnt from the following question that I can only get access to the folder storing all my iBook files using terminal:

Where are my iBooks stored in macOS Sierra?

However, it seems that I couldn't use terminal when using Time Machine to restore old files. Is there any way to get around this?

I'm running macOS High Sierra.

Best Answer

You should be able to restore the PDF from the backup using the command-line technique I posted in How can I restore iBooks stored in iCloud from a Time Machine backup?

Find the most appropriate backup:

$ tmutil listbackups 
[...]
/Volumes/Time Machine Backups/Backups.backupdb/macbook/2017-12-11-123506
/Volumes/Time Machine Backups/Backups.backupdb/macbook/2017-12-12-212807
/Volumes/Time Machine Backups/Backups.backupdb/macbook/2017-12-13-224355

Check if your missing PDF is available:

$ ls '/Volumes/Time Machine Backups/Backups.backupdb/macbook/2017-12-12-212807/Macintosh HD/Users/USERNAME/Library/Mobile Documents/iCloud~com~apple~iBooks/Documents/file.pdf'
/Volumes/Time Machine Backups/Backups.backupdb/macbook/2017-12-12-212807/Macintosh HD/Users/USERNAME/Library/Mobile Documents/iCloud~com~apple~iBooks/Documents/file.pdf

This assumes you know the name of the file, but if not you can omit the file.pdf and you'll get the full listing for the directory.

Restore the file to your Desktop:

$ tmutil restore '/Volumes/Time Machine Backups/Backups.backupdb/macbook/2017-12-12-212807/Macintosh HD/Users/USERNAME/Library/Mobile Documents/iCloud~com~apple~iBooks/Documents/file.pdf' /Users/USERNAME/Desktop/
Total copied: 7.89 MB (8270868 bytes)
Items copied: 1

Then you can add the PDF to iBooks again as normal.