Skip to content

iMessage

iMessage can be read two ways. Pick one with MEMCAL_IMESSAGE_BACKEND:

Run memcal setup --section imessage to choose the local database or BlueBubbles. Choosing BlueBubbles also prompts for its server URL, hidden password, fallback, server location, and automatic startup. Enter keeps saved values; all changes are confirmed together before saving.

  • bluebubbles: read through your BlueBubbles server — groups, participants, attachments, and clean message text, and the server can run on another Mac. Set the password with bluebubbles= and, for a non-default address, the URL with bluebubblesurl= in the store's .env.
  • chatdb (default): read ~/Library/Messages/chat.db on this Mac directly. No server or password; needs Full Disk Access for whatever runs the pass. attributedBody message bodies are decoded with the pytypedstream library.

Incremental on re-runs with its own stored cursor, deduplicated into the archive like everything else. Verify with memcal sources, then memcal ingest imessage --limit 20.

Inbound handles resolve through Contacts at ingest, so phone numbers arrive already attached to people. See Identity.

For local chatdb ingestion, a sent message in a direct chat is associated with that chat's sole counterpart even when its own sender handle is absent. A chat with two other participants is treated as a group, preserving conversation routing.

Fixing local database access

memcal doctor and memcal sources attempt a read-only query of chat.db and show the actual permission steps when it fails. File existence alone does not prove that macOS permits the database to be opened.

  1. Open System Settings → Privacy & Security → Full Disk Access.
  2. Add and enable ~/.memcal/memcal.app (Finder's Go to Folder can open ~/.memcal).
  3. Quit and reopen Memcal, then run memcal doctor again.

If the app is missing, memcal permissions setup prepares it. CLI and web source reads use the Memcal app bridge, so your terminal or agent does not need Full Disk Access. Calendar consent does not grant Messages access.

Choosing and tuning the backend

Setting Values Default What it does
MEMCAL_IMESSAGE_BACKEND chatdb, bluebubbles chatdb Which transport to read iMessage through. chatdb never contacts BlueBubbles.
MEMCAL_IMESSAGE_FALLBACK on/off on With the bluebubbles backend, read the local chat.db when the server is unreachable. Off makes an unreachable server a hard failure instead.
MEMCAL_BLUEBUBBLES_LOCATION auto, local, remote auto Where the server runs, which decides whether opening the app could help. auto infers it from the URL (localhost is local); local forces "this Mac"; remote forces "another machine".
MEMCAL_BLUEBUBBLES_AUTOSTART on/off on Open BlueBubbles when a local server is down (see below).

Connection details live in the store's .env, not as MEMCAL_* settings:

  • bluebubbles=<password> — the server password (required for the bluebubbles backend).
  • bluebubblesurl=<url> — the server address. Defaults to http://localhost:1234. Point it at another machine for a remote server, e.g. http://mymac.local:1234.

Opening BlueBubbles automatically

The BlueBubbles server only answers while its app is running. When the nightly (or scheduled) pass finds a local server down, it opens the app for you — hidden and in the background (open -g -j), so no window appears and it is never brought to fullscreen — waits a few seconds for it to answer, then reads through it. If it does not come up in time, the pass falls back to chat.db (unless the fallback is off).

This only ever happens from the nightly/scheduled pass, never from a plain memcal ingest, and only when all of these hold:

  • MEMCAL_IMESSAGE_BACKEND is bluebubbles,
  • MEMCAL_BLUEBUBBLES_AUTOSTART is on,
  • a bluebubbles= password is configured,
  • the server is local — MEMCAL_BLUEBUBBLES_LOCATION is local, or auto with a localhost URL — so a remote server is never launched,
  • the BlueBubbles app is installed on this Mac,
  • the server is not already answering.

To stop it opening the app, set MEMCAL_BLUEBUBBLES_AUTOSTART=0; to keep it from ever touching a machine that only hosts the server remotely, set MEMCAL_BLUEBUBBLES_LOCATION=remote.

Recipes

Local server, open it when it is down:

MEMCAL_IMESSAGE_BACKEND=bluebubbles
# bluebubbles=<password> in .env; URL defaults to http://localhost:1234

Remote server on another Mac, never launch anything locally, fail rather than read a local database:

MEMCAL_IMESSAGE_BACKEND=bluebubbles
MEMCAL_BLUEBUBBLES_LOCATION=remote
MEMCAL_IMESSAGE_FALLBACK=0
# bluebubblesurl=http://mymac.local:1234 and bluebubbles=<password> in .env

Skip BlueBubbles entirely and read the local database:

MEMCAL_IMESSAGE_BACKEND=chatdb

Use memcal permissions setup or Settings → Full Disk Access in the web UI for guided approval and rechecking. The helper opens the system pane and reveals the right app; macOS keeps approval in your hands.