Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Apple Books Exporter

A command-line tool to export all your locally stored books from Apple Books to any directory on macOS.

Features

  • 🚀 Fast bulk export of all your Apple Books library
  • 📚 Preserves original formats (EPUB, PDF)
  • 🏷️ Clean filenames using book titles
  • 🗂️ Automatic EPUB handling - converts EPUB directories to proper .epub files
  • 🎯 Smart file detection - finds books in multiple storage locations
  • 🔍 Verbose mode for detailed progress tracking
  • 🧪 Dry run mode to preview what will be exported
  • Progress indicators during export

Requirements

  • macOS with Apple Books installed
  • Books must be downloaded locally (not just stored in iCloud)
  • Command line access

Installation

Quick Install (Recommended)

# Download and install
curl -L https://github.com/jonnyace/apple-books-exporter/raw/main/export-books -o /usr/local/bin/export-books
chmod +x /usr/local/bin/export-books

# Or install to your local bin directory
curl -L https://github.com/jonnyace/apple-books-exporter/raw/main/export-books -o ~/.local/bin/export-books
chmod +x ~/.local/bin/export-books

Manual Install

  1. Download the script:

    git clone https://github.com/jonnyace/apple-books-exporter.git
    cd apple-books-exporter
  2. Make it executable:

    chmod +x export-books
  3. (Optional) Copy to your PATH:

    cp export-books /usr/local/bin/

Usage

Basic Usage

Export all books to default location (~/Desktop/Exported_Books):

export-books

Advanced Usage

# Export to custom directory
export-books --output ~/Documents/MyBooks

# Export with verbose progress
export-books --verbose --output /Volumes/External/Books

# Preview what would be exported (dry run)
export-books --dry-run

# Show help
export-books --help

Command Line Options

Option Description
-o, --output DIR Output directory (default: ~/Desktop/Exported_Books)
-v, --verbose Show detailed progress information
-h, --help Show help message
--version Show version information
--dry-run Preview export without copying files

How It Works

The tool works by:

  1. Reading Apple Books database - Accesses the SQLite database where Apple Books stores metadata
  2. Finding local files - Locates actual book files in various Apple Books storage locations:
    • ~/Library/Containers/com.apple.BKAgentService/Data/Documents/iBooks/Books/
    • ~/Library/Mobile Documents/iCloud~com~apple~iBooks/Documents/
  3. Processing files - Handles different formats appropriately:
    • EPUB directories: Zipped into proper .epub files
    • PDF files: Copied directly
  4. Clean naming - Uses book titles for filenames, sanitized for filesystem compatibility

Example Output

$ export-books --verbose
[INFO] Found 1,234 books with local files
[INFO] Exporting books to: /Users/username/Desktop/Exported_Books
[1/1234] Zipping: Example Book Title
[2/1234] Copying: Another Book.pdf
[3/1234] Zipping: Sample Novel
...
[SUCCESS] Export completed successfully!
[SUCCESS] All 1,234 books exported to: /Users/username/Desktop/Exported_Books

Troubleshooting

"Apple Books database not found"

  • Make sure Apple Books is installed and has been opened at least once
  • Ensure you're running on macOS

"No books with local files found"

  • Your books might only exist as metadata (not downloaded)
  • Download books locally in Apple Books first
  • Check if books are stored in iCloud but not synced locally

"Failed to read Apple Books database"

  • Close Apple Books before running the export
  • Check file permissions

Permission Issues

# If you get permission errors, try:
sudo chown -R $(whoami) ~/Desktop/apple-books-exporter

What Gets Exported vs. What Doesn't

✅ Exported

  • Books with local files (.epub directories, .pdf files)
  • Both purchased and manually imported books
  • Books stored in Apple Books containers
  • Books in iCloud Documents (if synced locally)

❌ Not Exported

  • Books that exist only as metadata (not downloaded)
  • Sample books
  • Audiobooks (different storage system)
  • Books removed but with remaining metadata

Privacy & Security

  • This tool only reads your local Apple Books database and files
  • No data is transmitted anywhere
  • All operations are performed locally on your machine
  • The tool is read-only - it never modifies your Apple Books library

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT License - see LICENSE file for details.

Changelog

v1.0.0

  • Initial release
  • Basic export functionality
  • EPUB and PDF support
  • Verbose and dry-run modes
  • Cross-platform file detection

Author

Created by @jonnyace

Support

If you encounter issues:

  1. Check the troubleshooting section
  2. Run with --verbose flag for detailed output
  3. Open an issue on GitHub with the error details

Star this repo if it helped you!

About

No description, website, or topics provided.

Resources

Stars

6 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages