imessage

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

iMessage

iMessage

Use
imsg
to read and send iMessage/SMS via macOS Messages.app.
使用
imsg
通过macOS Messages.app读取和发送iMessage/SMS消息。

Prerequisites

前提条件

  • macOS with Messages.app signed in
  • Install:
    brew install steipete/tap/imsg
  • Grant Full Disk Access for terminal (System Settings → Privacy → Full Disk Access)
  • Grant Automation permission for Messages.app when prompted
  • 已登录Messages.app的macOS系统
  • 安装命令:
    brew install steipete/tap/imsg
  • 为终端授予完全磁盘访问权限(系统设置 → 隐私与安全性 → 完全磁盘访问权限)
  • 出现提示时,为Messages.app授予自动化权限

When to Use

使用场景

  • User asks to send an iMessage or text message
  • Reading iMessage conversation history
  • Checking recent Messages.app chats
  • Sending to phone numbers or Apple IDs
  • 用户要求发送iMessage或短信
  • 读取iMessage对话历史
  • 查看Messages.app的近期聊天记录
  • 向电话号码或Apple ID发送消息

When NOT to Use

不适用场景

  • Telegram/Discord/Slack/WhatsApp messages → use the appropriate gateway channel
  • Group chat management (adding/removing members) → not supported
  • Bulk/mass messaging → always confirm with user first
  • Telegram/Discord/Slack/WhatsApp消息 → 使用对应的网关渠道
  • 群聊管理(添加/移除成员)→ 不支持此功能
  • 批量群发消息 → 必须先获得用户确认

Quick Reference

快速参考

List Chats

列出聊天记录

bash
imsg chats --limit 10 --json
bash
imsg chats --limit 10 --json

View History

查看历史消息

bash
undefined
bash
undefined

By chat ID

通过聊天ID

imsg history --chat-id 1 --limit 20 --json
imsg history --chat-id 1 --limit 20 --json

With attachments info

包含附件信息

imsg history --chat-id 1 --limit 20 --attachments --json
undefined
imsg history --chat-id 1 --limit 20 --attachments --json
undefined

Send Messages

发送消息

bash
undefined
bash
undefined

Text only

仅文本消息

imsg send --to "+14155551212" --text "Hello!"
imsg send --to "+14155551212" --text "Hello!"

With attachment

带附件

imsg send --to "+14155551212" --text "Check this out" --file /path/to/image.jpg
imsg send --to "+14155551212" --text "Check this out" --file /path/to/image.jpg

Force iMessage or SMS

强制使用iMessage或SMS

imsg send --to "+14155551212" --text "Hi" --service imessage imsg send --to "+14155551212" --text "Hi" --service sms
undefined
imsg send --to "+14155551212" --text "Hi" --service imessage imsg send --to "+14155551212" --text "Hi" --service sms
undefined

Watch for New Messages

监听新消息

bash
imsg watch --chat-id 1 --attachments
bash
imsg watch --chat-id 1 --attachments

Service Options

服务选项

  • --service imessage
    — Force iMessage (requires recipient has iMessage)
  • --service sms
    — Force SMS (green bubble)
  • --service auto
    — Let Messages.app decide (default)
  • --service imessage
    — 强制使用iMessage(要求收件人开通iMessage)
  • --service sms
    — 强制使用SMS(绿色气泡消息)
  • --service auto
    — 由Messages.app自动选择(默认选项)

Rules

规则

  1. Always confirm recipient and message content before sending
  2. Never send to unknown numbers without explicit user approval
  3. Verify file paths exist before attaching
  4. Don't spam — rate-limit yourself
  1. 发送前务必确认收件人和消息内容
  2. 未经用户明确许可,绝不向未知号码发送消息
  3. 发送前验证附件文件路径是否存在
  4. 不要发送垃圾消息 — 控制发送频率

Example Workflow

示例流程

User: "Text mom that I'll be late"
bash
undefined
用户:"发短信告诉妈妈我会晚点到"
bash
undefined

1. Find mom's chat

1. 查找妈妈的聊天记录

imsg chats --limit 20 --json | jq '.[] | select(.displayName | contains("Mom"))'
imsg chats --limit 20 --json | jq '.[] | select(.displayName | contains("Mom"))'

2. Confirm with user: "Found Mom at +1555123456. Send 'I'll be late' via iMessage?"

2. 向用户确认:"找到妈妈的号码+1555123456。是否通过iMessage发送'我会晚点到'?"

3. Send after confirmation

3. 获得确认后发送

imsg send --to "+1555123456" --text "I'll be late"
undefined
imsg send --to "+1555123456" --text "I'll be late"
undefined