Generate realistic, schema-accurate iMessage databases for testing and development
Project description
iMessage Data Foundry
Generate realistic iMessage and Address Book sqlite databases for mock testing and demo applications.
Overview
iMessage Data Foundry creates synthetic chat.db SQLite databases that exactly mirror the macOS iMessage schema. You have the option to use Ai to generate the personas and conversations. You can either use local models through mlx (note, really only for apple silicon though given the dependency on mlx-lm.), or OpenAI / Anthropic endpoints.
Good use cases for this synthetic data are:
- Testing iMessage analysis tools and exporters
- Development of applications that interface with iMessage data
- Demos and documentation requiring realistic message data
Demo
Features
- Full Schema Replication — Exact match of macOS iMessage
chat.dbstructure - Multi-Version Support — Sonoma (14.x), Sequoia (15.x), and Tahoe (26.x)
- AI-Powered Personas — Generate realistic personas with distinct personalities
- Natural Conversations — LLM-generated messages that feel authentic
- Persona Library — Save and reuse personas across database generations
- Group Chats — Support for both 1:1 and group conversations
- Realistic Timestamps — Natural message timing with conversation batching
- Attachment Stubs — Placeholder attachments with proper database records
Installation
From PyPI (recommended)
pip install imessage-data-foundry
With uvx (no install required)
uvx imessage-data-foundry
With pipx
pipx install imessage-data-foundry
From source
git clone https://github.com/johnlarkin1/imessage-data-foundry.git
cd imessage-data-foundry
pip install -e .
Quick Start
# Launch the TUI
uvx imessage-data-foundry
# Or run directly
uv run python -m imessage_data_foundry
CLI Options
imessage-data-foundry --help
imessage-data-foundry --version
imessage-data-foundry --output ~/Desktop/chat.db
imessage-data-foundry # interactive mode (this is the default)
Configuration
LLM Provider
Select your preferred LLM provider from the Settings menu in the app. Available providers depend on which API keys you have configured.
API Keys
Set API keys as environment variables before running the app:
export OPENAI_API_KEY="sk-..."
# or
export ANTHROPIC_API_KEY="sk-ant-..."
Local Models
For local inference on Apple Silicon, install mlx-lm:
pip install mlx-lm
Settings are stored in ~/.config/imessage-data-foundry/foundry.db.
Usage
Creating Personas
Personas can be created manually or generated by AI:
┌─ Create Persona ─────────────────────────────────┐
│ │
│ Name: Sarah Chen │
│ Phone: +1 (555) 123-4567 │
│ Relationship: Close friend from college │
│ │
│ Personality: │
│ Outgoing, tech-savvy software engineer who │
│ loves hiking and craft coffee. Quick to │
│ respond with enthusiasm and emoji. │
│ │
│ [Generate with AI] [Save] [Cancel] │
│ │
└──────────────────────────────────────────────────┘
Generating Conversations
- Select personas to include
- Choose chat type (1:1 or group)
- Set message count target
- Optionally provide a conversation seed
- Generate!
Output
The generated chat.db file can be used with any tool that reads iMessage databases:
# Example: Use with imessage-exporter
imessage-exporter -p ./output/chat.db -f html -o ./export/
API Keys
You'll need an API key from one of the supported providers:
| Provider | Get API Key |
|---|---|
| OpenAI | https://platform.openai.com/api-keys |
| Anthropic | https://console.anthropic.com/settings/keys |
Project Structure
imessage-data-foundry/
├── imessage_data_foundry/
│ ├── cli/ # CLI application and flows
│ ├── db/ # Database schema and building
│ ├── personas/ # Persona management
│ ├── conversations/ # Conversation generation
│ ├── llm/ # LLM provider integrations
│ ├── settings/ # Settings storage
│ └── utils/ # Utility functions
├── tests/ # Test suite
└── docs/ # Documentation
Schema Compatibility
Generated databases are tested for compatibility with:
Limitations
- Text-only focus — Reactions, read receipts, and message effects are not simulated
- Placeholder attachments — Attachments are stubs, not real media files
- macOS-centric — Schema targets macOS; iOS backup databases may differ slightly
Development
# Install dev dependencies
uv sync --dev
# Run tests
uv run pytest
# Run type checking
uv run mypy src/
# Format code
uv run ruff format src/
License
MIT License — See LICENSE for details.
Acknowledgments
- Schema research informed by imessage-exporter
- Built with Textual for the beautiful TUI
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file imessage_data_foundry-1.0.0.tar.gz.
File metadata
- Download URL: imessage_data_foundry-1.0.0.tar.gz
- Upload date:
- Size: 164.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a47a569a35b5c592a8103affba7afdef8cf14462c2a4bddb9cd2f3d8240efbe
|
|
| MD5 |
6b40a8e56166512f02a274abad2dc97c
|
|
| BLAKE2b-256 |
112341daf3ba2904d871f0bda8d2a9fe9b12c454eb7738adfbcd381d02531cbe
|
Provenance
The following attestation bundles were made for imessage_data_foundry-1.0.0.tar.gz:
Publisher:
cd.yaml on johnlarkin1/imessage-data-foundry
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
imessage_data_foundry-1.0.0.tar.gz -
Subject digest:
1a47a569a35b5c592a8103affba7afdef8cf14462c2a4bddb9cd2f3d8240efbe - Sigstore transparency entry: 832434129
- Sigstore integration time:
-
Permalink:
johnlarkin1/imessage-data-foundry@bb16020be8c75f3a94356298926ef26dd84d5aba -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/johnlarkin1
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cd.yaml@bb16020be8c75f3a94356298926ef26dd84d5aba -
Trigger Event:
push
-
Statement type:
File details
Details for the file imessage_data_foundry-1.0.0-py3-none-any.whl.
File metadata
- Download URL: imessage_data_foundry-1.0.0-py3-none-any.whl
- Upload date:
- Size: 72.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7916d75905c877cfa2b0676f067fa28e7ba4a8cf794621eabc21588ec78ff619
|
|
| MD5 |
c9e221df22727f6dddd0ec72cada17ff
|
|
| BLAKE2b-256 |
4376695296e09f1e89853721971ddecdd446957a61573391dba28cdf53b278e8
|
Provenance
The following attestation bundles were made for imessage_data_foundry-1.0.0-py3-none-any.whl:
Publisher:
cd.yaml on johnlarkin1/imessage-data-foundry
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
imessage_data_foundry-1.0.0-py3-none-any.whl -
Subject digest:
7916d75905c877cfa2b0676f067fa28e7ba4a8cf794621eabc21588ec78ff619 - Sigstore transparency entry: 832434130
- Sigstore integration time:
-
Permalink:
johnlarkin1/imessage-data-foundry@bb16020be8c75f3a94356298926ef26dd84d5aba -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/johnlarkin1
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cd.yaml@bb16020be8c75f3a94356298926ef26dd84d5aba -
Trigger Event:
push
-
Statement type: