安装/使用 imsg,命令行管理 iphone 短信的工具

🕐

安装一个有意思的软件 imsg,使用命令行管理 iphone 的 iMessage

01 使用 brew 安装

安装命令如下

brew install steipete/tap/imsg

02 测试安装情况

列出5条最近的消息记录

$ imsg chats --limit 5
[39]  (1065502009555810) last=2026-03-06T06:53:30.624Z
[5338] 10693886990000000255 (10693886990000000255) last=2026-03-06T04:12:47.992Z
[62]  (106980095566) last=2026-03-06T03:22:48.887Z
[5337] 10689322402462660 (10689322402462660) last=2026-03-06T02:01:47.497Z
[89]  (106980095558) last=2026-03-05T06:47:31.956Z

03 给自己的手机发短信

给自己的手机发消息

$ imsg send --text test=by-aric --to +8617600001608
sent

04 更多其它的 command

其它命令列表

imsg chats [--limit 20] [--json] — list recent conversations.
imsg history --chat-id <id> [--limit 50] [--attachments] [--participants +15551234567,...] [--start 2025-01-01T00:00:00Z] [--end 2025-02-01T00:00:00Z] [--json]
imsg watch [--chat-id <id>] [--since-rowid <n>] [--debounce 250ms] [--attachments] [--participants …] [--start …] [--end …] [--json]
imsg send --to <handle> [--text "hi"] [--file /path/img.jpg] [--service imessage|sms|auto] [--region US]

05 更多使用示例

示例(Quick Example)

# list 5 chats
imsg chats --limit 5

# list chats as JSON
imsg chats --limit 5 --json

# last 10 messages in chat 1 with attachments
imsg history --chat-id 1 --limit 10 --attachments

# filter by date and emit JSON
imsg history --chat-id 1 --start 2025-01-01T00:00:00Z --json

# live stream a chat
imsg watch --chat-id 1 --attachments --debounce 250ms

# send a picture
imsg send --to "+14155551212" --text "hi" --file ~/Desktop/pic.jpg --service imessage
apple
message
imsg