Skip to content

About

Standalone Rust CLI to read and search the native WhatsApp Mac app. Local and read-only.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

WhatsApp CLI for macOS

Read and search your local WhatsApp messages from a terminal or coding agent.

wacli is a standalone Rust executable that reads the database maintained by the native WhatsApp Mac app. It is local and read-only: no browser automation, cloud service, separate QR pairing, Slack dependency, or helper runtime.

Download the latest release · Slack CLI

What it does

  • Lists chats and their exact IDs.
  • Reads messages in a selected chat, newest first.
  • Searches message text, across chats or within one chat.
  • Reports local message counts and the latest stored message time.
  • Prints JSON for scripts and agents, with explicit pagination.

It does not send messages, mark conversations as read, download attachments, or connect directly to WhatsApp servers. Only messages already synced to this Mac are available. It cannot recover missing, deleted, or unsynced phone history. Media messages may have empty text; the CLI returns their stored message type. This is an unofficial local database reader, not the WhatsApp Business API.

Install

Requires macOS 11 or newer and the native WhatsApp Mac app, signed in and synced. End users do not need Rust, Python, Node.js, Homebrew, or a database installation.

  1. Download wacli-macos-arm64.tar.gz for an Apple Silicon (M-series) Mac, or wacli-macos-x86_64.tar.gz for Intel, from the release page.
  2. Extract the archive, which contains the executable, README, and license.
  3. Run these commands in the extracted folder:
mkdir -p "$HOME/.local/bin"
install -m 755 ./wacli "$HOME/.local/bin/wacli"
export PATH="$HOME/.local/bin:$PATH"
wacli --version
wacli status

Add export PATH="$HOME/.local/bin:$PATH" to ~/.zshrc once to keep the command available in new terminals. Updating uses the same download/install steps.

Verify the archive with shasum -a 256 wacli-macos-arm64.tar.gz (or the Intel filename) and compare with the release's SHA256SUMS before installing. Downloads are ad-hoc signed, not Apple-notarized. If macOS blocks a verified browser download, allow that binary in System Settings → Privacy & Security. If it remains quarantined, xattr -d com.apple.quarantine "$HOME/.local/bin/wacli" removes quarantine from that one file. Do not disable Gatekeeper globally.

Permissions and first use

Open WhatsApp Desktop and let it sync before running wacli status. No Slack Keychain approval or additional WhatsApp login is needed for this reader.

If macOS denies database access, grant the invoking Terminal or agent application access under System Settings → Privacy & Security → Full Disk Access, then reopen it. Only change this permission when access is denied. Do not share your database or passwords with an agent to work around a local permission error.

The default source is:

~/Library/Group Containers/group.net.whatsapp.WhatsApp.shared/ChatStorage.sqlite

For a compatible alternate local database, pass --db /absolute/path/to/file. The CLI fails if the file is missing; it never creates an empty database there.

Commands

wacli status
wacli chats
wacli chats 'Project group' --limit 20
wacli read 'EXACT_CHAT_ID_FROM_CHATS' --limit 50
wacli search 'meeting' --limit 20
wacli search 'meeting' --chat 'EXACT_CHAT_ID_FROM_CHATS' --limit 20
wacli --db /path/to/ChatStorage.sqlite status

Use the exact id from chats in read and --chat. Duplicate display names cannot select the wrong conversation. chats matches a literal name or ID substring. search matches literal text, not SQL wildcards or regular expressions; % and _ are ordinary characters. Matching uses SQLite's ASCII case folding, so Unicode case-insensitive and semantic search are not supported.

Pagination

--limit accepts 1–500 (default 50). --offset starts at zero. Results include has_more and next_offset; pass the latter to continue:

wacli read 'EXACT_CHAT_ID_FROM_CHATS' --limit 50 --offset 50

Each query sees a consistent database snapshot, including committed WAL data. Pagination across separate runs uses offsets, so incoming messages can shift page boundaries. For an unchanging export, query a consistent local backup.

JSON output

A synthetic message result looks like:

{
  "source": "whatsapp-macos",
  "order": "newest_first",
  "items": [{
    "local_id": 12,
    "message_id": "example-message",
    "chat_id": "example@g.us",
    "chat_name": "Example group",
    "timestamp": "2026-01-01T10:00:00Z",
    "from_me": false,
    "sender_id": "example-sender",
    "sender_name": "Alex",
    "text": "Meeting at noon",
    "message_type": 0
  }],
  "has_more": false,
  "next_offset": null
}

Timestamps are UTC ISO 8601; missing and out-of-range sentinel dates become null. message_type is WhatsApp's internal numeric code, not a stable public enumeration. Successful output goes to stdout. Errors go to stderr with nonzero exit status; argument errors use standard CLI help.

Privacy and limitations

The executable makes no network requests and stores no additional message cache. It opens the app database with SQLite read-only flags plus query_only, and executes only fixed, parameterized read queries. Reading leaves message state unchanged. Protect output as private data; never submit real conversations or app database files in public issues or test fixtures.

The database schema is unofficial and can change with WhatsApp updates. Schema mismatches fail explicitly. Verified locally with WhatsApp for Mac 26.35.23; this does not guarantee support for every older or future version. Windows, Linux, WhatsApp Web, encrypted phone backups, sending, and attachment downloads are outside this version's scope.

Build and test

Contributors need Rust 1.92+ and Xcode Command Line Tools. Download users do not.

cargo test --locked
cargo fmt --check
cargo clippy --locked --all-targets -- -D warnings
cargo build --locked --release
./target/release/wacli --help
./scripts/package.sh

Tests use synthetic databases and cover live WAL reads, exact chat selection, literal search, paging, timestamp sentinels, missing/schema-invalid files, and unchanged database/WAL bytes. CI also builds Apple Silicon and Intel archives. scripts/package.sh creates archives and SHA-256 checksums in dist/.

SQLite is bundled into the executable; only macOS system libraries are dynamic dependencies. The Rust Turso engine was considered, but its compatibility guide excludes mixed SQLite/Turso access from separate processes. WhatsApp owns and updates this live SQLite database, so the reader uses SQLite's compatible locking and WAL behavior. No Turso account, server, or SQLite installation is required.

Troubleshooting

  • Database not found: install/sign into native WhatsApp, open it, and sync.
  • Permission denied: check permissions for the app invoking the command.
  • Old or missing messages: compare latest_local_message_at with WhatsApp; the CLI cannot force a server sync.
  • Chat not found: obtain its exact ID using chats, not its display name.
  • Unsupported schema: include the CLI and WhatsApp versions in a bug report, plus the error text only. Do not attach private database files.

License

MIT, copyright Grail Computer. WhatsApp is a trademark of its owner. This project is independent and is not affiliated with or endorsed by WhatsApp or Meta.

About

Standalone Rust CLI to read and search the native WhatsApp Mac app. Local and read-only.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages