iMessage Analysis
Ask questions about your entire iMessage history — from an AI agent, the terminal, or a Python notebook. Works on Mac.
What it does
- Ask your AI — connect to Claude, Codex, Cursor, or ChatGPT and ask things like "Who do I text most?" or "What did Alice and I talk about last month?"
- Search and query — run any question against your messages from the terminal
- Python notebooks — load your message data into pandas for custom analysis
- Always current — syncs only new messages each run, so it stays fast
- Real names — reads your Contacts to show names instead of phone numbers
Quickstart
With Claude Code, Codex, or Cursor
1. Install the skills package:
npx skills add DecisionNerd/imessage-analysis
2. Run the setup command inside your AI tool:
/imessage-analysis-install
This installs the binary, connects it to your AI tool, and walks you through the first sync — including a note about using Apple Terminal the first time so macOS can ask for Contacts permission.
3. Ask anything:
"Who have I texted most this year?" "Give me a deep dive on Alice" "Who's been waiting on a reply from me?"
With Claude Desktop, ChatGPT, or any other AI tool
curl -fsSL https://raw.githubusercontent.com/DecisionNerd/imessage-analysis/main/scripts/install.sh | bash
Detects and connects to Claude Desktop, Cursor, Claude Code, and Codex automatically. See MCP setup for manual steps.
From the terminal only
1. Give Terminal permission to read your messages:
System Settings → Privacy & Security → Full Disk Access → enable Terminal
2. Install:
brew tap DecisionNerd/tap
brew install imessage-analysis
3. Run your first sync from Apple Terminal.app (not iTerm2 or other terminals — macOS needs this to ask for Contacts permission the first time):
imessage-analysis sync
4. Start exploring:
imessage-analysis status
imessage-analysis top-contacts --limit 10
imessage-analysis time-series --year 2024
imessage-analysis reactions --received
imessage-analysis search-contacts alice
imessage-analysis query "SELECT year, COUNT(*) AS n FROM messages GROUP BY year ORDER BY year"
Use with Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"imessage": { "command": "imessage-mcp" }
}
}
Use with Python
pip install imessage-analysis
import imessage_analysis
df = imessage_analysis.top_contacts().to_pandas()
df = imessage_analysis.query("SELECT * FROM messages WHERE year = 2024").to_pandas()
Note:
imessage_analysis.sync()picks up new messages but won't resolve contact names — that requires runningimessage-analysis syncfrom the terminal at least once.
Installation
| Method | Command |
|---|---|
| Homebrew | brew tap DecisionNerd/tap && brew install imessage-analysis |
| Cargo | cargo install --git https://github.com/DecisionNerd/imessage-analysis |
| PyPI | pip install imessage-analysis |
| Claude Code / Codex / Cursor | npx skills add DecisionNerd/imessage-analysis |
Requires macOS. Rust 1.70+ for source builds. Python 3.11+ for the Python package.
Documentation
| Installation | Full Disk Access, Homebrew, source, Python |
| CLI reference | All commands and flags |
| AI agent setup | Connecting to Claude, Codex, Cursor, ChatGPT |
| Python package | API reference, notebook examples |
| Data model | All 22 output columns |
| Contact resolution | Contacts.app + TOML overrides |
| Architecture | How it works under the hood |
| Releasing | Tagging, Homebrew formula update |
Contributing
- Fork the repo and create a branch
cargo test --all— all tests must passcargo clippy -- -D warningsandcargo fmt- Open a pull request — CI runs automatically
This project uses Conventional Commits.
Attribution
Inspired by the foundational work of Yorgos Askalidis, who first documented how to access and analyse the macOS iMessage database. See his original Python implementation and write-ups:
This is a separate, ground-up Rust rewrite that extends the concept with a native CLI, AI agent integration, and Python bindings.
License
Copyright (C) 2026 David Spencer. Released under the GNU General Public License v3.0.
Metadata
Release files for imessage-analysis 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| imessage_analysis-0.2.0-cp311-abi3-macosx_11_0_arm64.whl | CPython 3.11 | abi3 | macOS 11.0+ ARM64 | Details |
| imessage_analysis-0.2.0-cp311-abi3-macosx_10_12_x86_64.whl | CPython 3.11 | abi3 | macOS 10.12+ x86-64 | Details |
Total release size: 80.8 MB
Release files / imessage_analysis-0.2.0-cp311-abi3-macosx_11_0_arm64.whl
| Download URL | imessage_analysis-0.2.0-cp311-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 39.4 MB |
| Tags | CPython 3.11 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
82d594055f71daf6a5922698388e50393cb5701db71c55578628973aeebf8637
|
|
BLAKE2b-256 checksum How to use checksums |
8dda51024c3f44b95f81e417c865c8a3eeaf4952b906ad82032f38c3882450f5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 22, 2026.
Transparency logRelease files / imessage_analysis-0.2.0-cp311-abi3-macosx_10_12_x86_64.whl
| Download URL | imessage_analysis-0.2.0-cp311-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 41.4 MB |
| Tags | CPython 3.11 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
7fc8a85c1c2d4b31aae8f324e72c8af6c7727350aaf9180bfa58f6efb1a2f831
|
|
BLAKE2b-256 checksum How to use checksums |
3673f2ca5b98466e70edaa519e48fa9be347edaf92dcba3b57773b3898535d1a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 22, 2026.
Transparency log