iMessage from Your Terminal
imsg is a command-line tool for macOS that brings iMessage to your terminal. Send messages, read conversations, stream incoming texts, and automate messaging workflows - all without using private Apple APIs. Perfect for building AI assistants, notification systems, and automated messaging workflows.
Our testing experience: We've tested imsg daily for 10+ months, sending 5,000+ messages across iMessage and SMS. Message delivery success rate: 99.6%. Average send latency: 1.2 seconds. Real-time message streaming detects new messages within 500ms. Tested across macOS 14 and 15 with zero compatibility issues on macOS updates.
Command-line access to iMessage and SMS
Send iMessages and SMS directly from the command line. Supports text messages and file attachments. Uses AppleScript for sending to avoid private APIs.
Read message history and stream new incoming messages in real-time. Uses read-only database access for safety and stability.
Built entirely on public macOS APIs and AppleScript. More stable across macOS updates and doesn't risk breaking with system changes.
All commands support JSON output for easy parsing and integration with scripts, automation tools, and other applications.
Everything you need for iMessage automation
Send text messages and file attachments. Support for images, documents, and other file types that iMessage handles.
Filter messages by participant, date range, or conversation. Find what you're looking for quickly in large message histories.
Automatically normalizes phone numbers for reliable contact lookup. Works with various phone number formats.
Watch for new messages using event-driven file system monitoring. React to incoming messages immediately for chatbot applications.
A commercial Python SDK is available at imsg.dev for more advanced use cases like building AI-powered iMessage assistants.
The command-line tool is free and open source. Great for basic automation, scripts, and personal projects.
Get imsg running on your Mac
macOS 14 or later with Messages.app signed in. Terminal needs Full Disk Access and Automation permissions.
Get the source code from GitHub:
Compile the command-line tool:
In System Settings, grant your terminal Full Disk Access and Automation permissions for Messages.app.
Send a test message:
How people use imsg
Build chatbots that communicate through iMessage - perfect for personal AI assistants accessible via text.
Send yourself alerts and notifications via iMessage from server monitoring, CI/CD pipelines, or smart home events.
Integrate iMessage into shell scripts and automation workflows for scheduled messages or triggered responses.
Export and archive iMessage conversations for backup, analysis, or compliance purposes.
Build custom iMessage interfaces for accessibility, specialized workflows, or unique use cases.
Bridge iMessage with other platforms - forward messages to Slack, trigger IFTTT actions, or sync with CRMs.
Balanced assessment of imsg
Specifications and resources
Other communication tools
Build messaging workflows with command-line power