Interactive CLI wrapper for imessage-exporter with contact name resolution and post-processing
Project description
imexp
An interactive CLI wrapper for imessage-exporter that adds contact name resolution and post-processing to your iMessage exports.
Features
- Saved profiles — define client/project presets in
config.iniand runimexpwith no selector - Strict conversation filters — resolve exact handles locally before calling
imessage-exporter - Selector preflight — inspect the resolved handles and matching chats before export
- Exact selector mode — refuse exports when union filtering would broaden beyond the selected participant set
- Interactive wizard — run
imexp --wizardorimexp export --wizardfor a guided export - Natural language dates — use phrases like "last 6 months" or "2 weeks ago"
- Contact resolution — automatically maps phone numbers and emails to names from your macOS or iOS Contacts database
- iOS backup support — auto-detects backups and lets you pick by device name/date
- Post-processing — renames exported files and replaces raw handles with contact names
- Export history — tracks your last export date to avoid duplicates
Requirements
- Python 3.12+
- macOS or Windows for the official wheels
macOS local Address Book lookups require macOS. iOS backup exports work on both macOS and Windows.
Installation
Install from PyPI:
pip install imexp
Official wheels bundle the matching imessage-exporter binary for:
- macOS Apple Silicon
- macOS Intel
- Windows x86_64
Source installs do not bundle the exporter binary. For editable or source installs, either:
- install
imessage-exporterseparately and keep it onPATH - point
IMEXP_EXPORTER_PATHat a local binary
Example source install:
git clone https://github.com/code-switched/imexp.git
cd imexp
pip install -e .
Usage
Interactive mode
If you do not configure a default profile, running imexp or imexp export with no arguments
starts the guided wizard:
imexp
To force the wizard even when a default profile exists:
imexp --wizard
The wizard prompts for:
- Platform (macOS or iOS backup)
- Date range (natural language supported)
- Export location
Command-line mode
imexp export --start-date "2024-01-01" --end-date "2024-06-01" --format txt
Saved profiles
Profiles let you define the handles you care about for a client or project and reuse them across repositories.
Canonical example: data/config/imexp/config.example.ini
Example contents:
[export]
default_profile = client-a
output_dir = ./data/messages/sms
[profile.client-a]
handles =
+15551234567
client@example.com
names =
Client Contact
Alternate Contact Label
label = Client Contact
slug = client-contact
platform = macOS
format = txt
copy_method = full
use_caller_id = true
Then run:
imexp
Or select a profile explicitly:
imexp export --profile client-a --start-date "last 30 days"
By default, selector mode is union: any chat containing one of the selected handles is included
because upstream filtering is participant-union based.
To make that safe for client-context exports, use:
imexp export --profile client-a --selector-preflight
imexp export --profile client-a --selector-mode exact
--selector-preflight prints the resolved handles plus the exact chat sets that would match.
--selector-mode exact refuses the export if any matched chat would bring in participants outside
the selected handle set.
Profile fields:
handlesare the canonical selectors used for export filtering.namesare optional display aliases used only for filename normalization.labelis the human-friendly display name for that profile.slugis the optional folder-name override. If omitted, it is derived fromlabelor the profile key.
Strict filter behavior
--conversation-filter no longer passes raw free text straight through to upstream name matching.
- Exact handles are normalized and matched locally first.
- Exact contact names are matched case-insensitively and rewritten to canonical handles.
- Ambiguous names fail and print the candidate handles.
- No-match filters fail instead of broadening the export.
Examples:
imexp export --conversation-filter "+1 (555) 123-4567"
imexp export --conversation-filter "Alice Smith"
Relabel existing exports
Re-run contact resolution on a previous export:
imexp relabel --export-path ./data/messages/sms/2024-01-15-10-30-00
Common options
| Option | Description |
|---|---|
--start-date |
Start date (natural language or YYYY-MM-DD) |
--end-date |
End date (defaults to now) |
--format |
Output format: txt, html (default: txt) |
--platform |
macOS or iOS |
--db-path |
Path to iOS backup or custom chat.db |
--export-path |
Custom output directory |
--selector-mode |
Selector safety mode: union or exact |
--selector-preflight |
Print selector resolution and matching chats without exporting |
--non-interactive |
Disable prompts for scripted use |
-v, --verbose |
Enable debug logging |
How it works
- Runs
imessage-exporterwith your specified options - Loads contacts from macOS Contacts.app or iOS backup
- Post-processes exported files:
- Renames files from phone numbers to contact names
- Replaces raw handles in file contents with names
- Saves unknown number → name mappings to
contacts.jsonfor future exports - Tracks export history in
history.jsonfor incremental exports
Configuration files
By default, repo-local files are stored under ./data/:
contacts.json— custom name overrides for unknown numbershistory.json— tracks last export dateconfig/imexp/config.ini— export defaults and saved profiles
See docs/dev/client-context.md for the design note behind the client-context workflow this tool is aiming at.
License
imexp is distributed under GPL-3.0-or-later.
The official wheels bundle the upstream imessage-exporter binary, which is also licensed under GPL-3.0.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
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 imexp-0.4.0.tar.gz.
File metadata
- Download URL: imexp-0.4.0.tar.gz
- Upload date:
- Size: 67.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e65f4c6b2fa94730fff2ed4c728db0f2538f0dff922dd4e2c1a8c2272c08e1b3
|
|
| MD5 |
68b74bba7d03095036920d236ebb7490
|
|
| BLAKE2b-256 |
b53a2e8ed2cf239e369c872f0a19b298268aa5a9690101fecf2e5a15442c6287
|
Provenance
The following attestation bundles were made for imexp-0.4.0.tar.gz:
Publisher:
release.yml on code-switched/imexp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
imexp-0.4.0.tar.gz -
Subject digest:
e65f4c6b2fa94730fff2ed4c728db0f2538f0dff922dd4e2c1a8c2272c08e1b3 - Sigstore transparency entry: 1967278792
- Sigstore integration time:
-
Permalink:
code-switched/imexp@78acb776daec9e66af5aeed042db174b6a8403a8 -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/code-switched
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@78acb776daec9e66af5aeed042db174b6a8403a8 -
Trigger Event:
push
-
Statement type:
File details
Details for the file imexp-0.4.0-py3-none-win_amd64.whl.
File metadata
- Download URL: imexp-0.4.0-py3-none-win_amd64.whl
- Upload date:
- Size: 2.1 MB
- Tags: Python 3, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
de17db19062bf964e0b10e26066643bca9e4df0c51ca01b7282a5d4b54da196f
|
|
| MD5 |
863fa87832e9c0338b46e2156def87ed
|
|
| BLAKE2b-256 |
165450fbd44296eea0d5c82bfcffba75e12cbf8365afc02486bfdb1d1975563d
|
Provenance
The following attestation bundles were made for imexp-0.4.0-py3-none-win_amd64.whl:
Publisher:
release.yml on code-switched/imexp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
imexp-0.4.0-py3-none-win_amd64.whl -
Subject digest:
de17db19062bf964e0b10e26066643bca9e4df0c51ca01b7282a5d4b54da196f - Sigstore transparency entry: 1967278995
- Sigstore integration time:
-
Permalink:
code-switched/imexp@78acb776daec9e66af5aeed042db174b6a8403a8 -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/code-switched
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@78acb776daec9e66af5aeed042db174b6a8403a8 -
Trigger Event:
push
-
Statement type:
File details
Details for the file imexp-0.4.0-py3-none-macosx_11_0_arm64.whl.
File metadata
- Download URL: imexp-0.4.0-py3-none-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.8 MB
- Tags: Python 3, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6ba4000457d5c5938c718bac842dda82cd35b11a2311da188f3f9b443bb189a2
|
|
| MD5 |
dad43011d2f7df431e0a541c51df6c92
|
|
| BLAKE2b-256 |
6ab54ff44edce9338e34b04247fb065115234e8942269c73504b11c5f18f0c3d
|
Provenance
The following attestation bundles were made for imexp-0.4.0-py3-none-macosx_11_0_arm64.whl:
Publisher:
release.yml on code-switched/imexp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
imexp-0.4.0-py3-none-macosx_11_0_arm64.whl -
Subject digest:
6ba4000457d5c5938c718bac842dda82cd35b11a2311da188f3f9b443bb189a2 - Sigstore transparency entry: 1967278910
- Sigstore integration time:
-
Permalink:
code-switched/imexp@78acb776daec9e66af5aeed042db174b6a8403a8 -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/code-switched
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@78acb776daec9e66af5aeed042db174b6a8403a8 -
Trigger Event:
push
-
Statement type:
File details
Details for the file imexp-0.4.0-py3-none-macosx_10_12_x86_64.whl.
File metadata
- Download URL: imexp-0.4.0-py3-none-macosx_10_12_x86_64.whl
- Upload date:
- Size: 1.9 MB
- Tags: Python 3, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
12d06ad1de87fe3bf8fbb5f36449cb832b3c92fbbce941051e3405bd75147b2a
|
|
| MD5 |
4abec8d242bab70ed03047b08023c3bd
|
|
| BLAKE2b-256 |
bd8cd0d7ce5b6bef18ce239bb28967db482e7aa9b029b542b20305fdb65185d4
|
Provenance
The following attestation bundles were made for imexp-0.4.0-py3-none-macosx_10_12_x86_64.whl:
Publisher:
release.yml on code-switched/imexp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
imexp-0.4.0-py3-none-macosx_10_12_x86_64.whl -
Subject digest:
12d06ad1de87fe3bf8fbb5f36449cb832b3c92fbbce941051e3405bd75147b2a - Sigstore transparency entry: 1967279102
- Sigstore integration time:
-
Permalink:
code-switched/imexp@78acb776daec9e66af5aeed042db174b6a8403a8 -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/code-switched
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@78acb776daec9e66af5aeed042db174b6a8403a8 -
Trigger Event:
push
-
Statement type: