Skip to main content

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.ini and run imexp with no selector
  • Strict conversation filters — resolve exact handles locally before calling imessage-exporter
  • Interactive wizard — run imexp --wizard or imexp export --wizard for 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-exporter separately and keep it on PATH
  • point IMEXP_EXPORTER_PATH at 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.

Example data/config/cli/config.ini:

[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"

In v1, profile handles are exact selectors for direct chats, and group-chat inclusion is approximate: any group containing one of the listed handles is included because upstream filtering is participant-union based.

Profile fields:

  • handles are the canonical selectors used for export filtering.
  • names are optional display aliases used only for filename normalization.
  • label is the human-friendly display name for that profile.
  • slug is the optional folder-name override. If omitted, it is derived from label or 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
--non-interactive Disable prompts for scripted use
-v, --verbose Enable debug logging

How it works

  1. Runs imessage-exporter with your specified options
  2. Loads contacts from macOS Contacts.app or iOS backup
  3. Post-processes exported files:
    • Renames files from phone numbers to contact names
    • Replaces raw handles in file contents with names
  4. Saves unknown number → name mappings to contacts.json for future exports
  5. Tracks export history in history.json for incremental exports

Configuration files

By default, files are stored in ./data/messages/sms/:

  • contacts.json — custom name overrides for unknown numbers
  • history.json — tracks last export date
  • cli/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

imexp-0.2.0.tar.gz (59.2 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

imexp-0.2.0-py3-none-win_amd64.whl (2.1 MB view details)

Uploaded Python 3Windows x86-64

imexp-0.2.0-py3-none-macosx_11_0_arm64.whl (1.8 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

imexp-0.2.0-py3-none-macosx_10_12_x86_64.whl (1.9 MB view details)

Uploaded Python 3macOS 10.12+ x86-64

File details

Details for the file imexp-0.2.0.tar.gz.

File metadata

  • Download URL: imexp-0.2.0.tar.gz
  • Upload date:
  • Size: 59.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for imexp-0.2.0.tar.gz
Algorithm Hash digest
SHA256 6d04e517d835a25feca0da685be81c385283c772cdbdcc0266e54715d28642fe
MD5 b4c3c329dea55d6362ec1e1a551b3555
BLAKE2b-256 db834a7f86d5be198908659abd1f405485c74b5aa79e6999185c815bb4d6ee64

See more details on using hashes here.

Provenance

The following attestation bundles were made for imexp-0.2.0.tar.gz:

Publisher: release.yml on code-switched/imexp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file imexp-0.2.0-py3-none-win_amd64.whl.

File metadata

  • Download URL: imexp-0.2.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

Hashes for imexp-0.2.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 c7717b8018a7b81ef71d4b24e5c83976cbe680a38709adc54f2581613ec601d8
MD5 d1284706da0b6d7e78ae7941b7bc3a70
BLAKE2b-256 58376b86601cfd201fdfbfa5c581f413223c915be5001bbe503475ad57f91dd4

See more details on using hashes here.

Provenance

The following attestation bundles were made for imexp-0.2.0-py3-none-win_amd64.whl:

Publisher: release.yml on code-switched/imexp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file imexp-0.2.0-py3-none-macosx_11_0_arm64.whl.

File metadata

  • Download URL: imexp-0.2.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

Hashes for imexp-0.2.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 81468eb3b1a1113d000ea2c6f02c6bfac4cc02422bb9e2cd1b939b30a7300de6
MD5 293746261dab1aebda9cc8341b88053b
BLAKE2b-256 4f1bc69f70ff8b9cc51be4f9930bc8e29c74a2ed19a6310040938f16e3cafcd0

See more details on using hashes here.

Provenance

The following attestation bundles were made for imexp-0.2.0-py3-none-macosx_11_0_arm64.whl:

Publisher: release.yml on code-switched/imexp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file imexp-0.2.0-py3-none-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for imexp-0.2.0-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 fdc2345e97c5a393aa0d52dacd6c299627b770b1472311fe4dd46a576c45c1b2
MD5 569cb3d5848456987942ac05df628c1d
BLAKE2b-256 fc9af284db4c91084cf46a1b0f128c2118fd40be404ca74e5949e6508dcd508a

See more details on using hashes here.

Provenance

The following attestation bundles were made for imexp-0.2.0-py3-none-macosx_10_12_x86_64.whl:

Publisher: release.yml on code-switched/imexp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page