메인 콘텐츠로 건너뛰기

iMessage (레거시: imsg)

새로운 iMessage 배포에는 BlueBubbles를 사용하세요.imsg 통합은 레거시이며 향후 릴리스에서 제거될 수 있습니다.
상태: 레거시 외부 CLI 통합입니다. Gateway가 imsg rpc를 실행하고 stdio 위에서 JSON-RPC로 통신합니다. 별도 daemon이나 port는 필요하지 않습니다.

빠른 설정

1

imsg 설치 및 확인

brew install steipete/tap/imsg
imsg rpc --help
2

OpenClaw 설정

{
  channels: {
    imessage: {
      enabled: true,
      cliPath: "/usr/local/bin/imsg",
      dbPath: "/Users/<you>/Library/Messages/chat.db",
    },
  },
}
3

gateway 시작

openclaw gateway
4

첫 DM pairing 승인 (기본 dmPolicy)

openclaw pairing list imessage
openclaw pairing approve imessage <CODE>
Pairing 요청은 1시간 후 만료됩니다.

요구 사항과 권한 (macOS)

  • imsg를 실행하는 Mac에서 Messages에 로그인되어 있어야 합니다.
  • OpenClaw/imsg가 실행되는 프로세스 컨텍스트에는 Full Disk Access가 필요합니다. (Messages DB 접근)
  • Messages.app을 통해 메시지를 보내려면 Automation 권한이 필요합니다.
권한은 프로세스 컨텍스트 단위로 부여됩니다. gateway가 headless(LaunchAgent/SSH)로 실행된다면, 같은 컨텍스트에서 아래 명령을 한 번 대화형으로 실행해 권한 프롬프트를 띄우세요.
imsg chats --limit 1
# or
imsg send <handle> "test"

접근 제어와 라우팅

channels.imessage.dmPolicy는 direct message 접근을 제어합니다.
  • pairing (기본값)
  • allowlist
  • open (allowFrom"*"가 있어야 함)
  • disabled
Allowlist 필드: channels.imessage.allowFromAllowlist 엔트리는 handle 또는 chat target(chat_id:*, chat_guid:*, chat_identifier:*)이 될 수 있습니다.

배포 패턴

bot 트래픽을 개인 Messages 프로필과 분리하려면, 전용 Apple ID와 macOS 사용자를 두는 것이 좋습니다.일반적인 흐름:
  1. 전용 macOS 사용자를 생성하고 로그인
  2. 해당 사용자에서 bot Apple ID로 Messages 로그인
  3. 해당 사용자 컨텍스트에 imsg 설치
  4. OpenClaw가 그 사용자 컨텍스트에서 imsg를 실행할 수 있도록 SSH wrapper 생성
  5. channels.imessage.accounts.<id>.cliPath.dbPath를 그 사용자 프로필로 지정
첫 실행에서는 해당 bot 사용자 세션에서 GUI 권한 승인(Automation + Full Disk Access)이 필요할 수 있습니다.
흔한 구성:
  • gateway는 Linux/VM에서 실행
  • iMessage + imsg는 tailnet 안의 Mac에서 실행
  • cliPath wrapper가 SSH로 imsg를 실행
  • remoteHost가 SCP 첨부 파일 가져오기를 활성화
예시:
{
  channels: {
    imessage: {
      enabled: true,
      cliPath: "~/.openclaw/scripts/imsg-ssh",
      remoteHost: "bot@mac-mini.tailnet-1234.ts.net",
      includeAttachments: true,
      dbPath: "/Users/bot/Library/Messages/chat.db",
    },
  },
}
#!/usr/bin/env bash
exec ssh -T bot@mac-mini.tailnet-1234.ts.net imsg "$@"
SSH와 SCP가 모두 비대화형으로 동작하도록 SSH key를 사용하세요. 먼저 ssh bot@mac-mini.tailnet-1234.ts.net처럼 접속해 host key를 신뢰시켜 known_hosts를 채워 두는 것이 좋습니다.
iMessage는 channels.imessage.accounts 아래의 per-account 설정을 지원합니다.각 계정은 cliPath, dbPath, allowFrom, groupPolicy, mediaMaxMb, history 설정, attachment root allowlist 같은 필드를 개별적으로 override할 수 있습니다.

미디어, 청킹, 전달 대상

  • inbound attachment 수집은 선택 사항: channels.imessage.includeAttachments
  • remoteHost가 설정되면 원격 첨부 파일 경로를 SCP로 가져올 수 있음
  • 첨부 파일 경로는 허용된 root와 일치해야 함:
    • channels.imessage.attachmentRoots (로컬)
    • channels.imessage.remoteAttachmentRoots (원격 SCP 모드)
    • 기본 root 패턴: /Users/*/Library/Messages/Attachments
  • SCP는 strict host-key checking(StrictHostKeyChecking=yes)을 사용
  • outbound media 크기는 channels.imessage.mediaMaxMb를 사용 (기본 16 MB)
  • text chunk limit: channels.imessage.textChunkLimit (기본 4000)
  • chunk mode: channels.imessage.chunkMode
    • length (기본값)
    • newline (문단 우선 분할)
권장되는 명시적 target:
  • chat_id:123 (안정적인 라우팅에 권장)
  • chat_guid:...
  • chat_identifier:...
Handle target도 지원됩니다.
  • imessage:+1555...
  • sms:+1555...
  • user@example.com
imsg chats --limit 20

설정 쓰기

iMessage는 기본적으로 채널에서 시작된 config write를 허용합니다. (commands.config: true일 때 /config set|unset) 비활성화:
{
  channels: {
    imessage: {
      configWrites: false,
    },
  },
}

문제 해결

바이너리와 RPC 지원 여부를 확인하세요.
imsg rpc --help
openclaw channels status --probe
probe가 RPC unsupported를 보고하면 imsg를 업데이트하세요.
다음 항목을 확인하세요.
  • channels.imessage.dmPolicy
  • channels.imessage.allowFrom
  • pairing 승인 상태 (openclaw pairing list imessage)
다음 항목을 확인하세요.
  • channels.imessage.groupPolicy
  • channels.imessage.groupAllowFrom
  • channels.imessage.groups allowlist 동작
  • mention pattern 설정 (agents.list[].groupChat.mentionPatterns)
다음 항목을 확인하세요.
  • channels.imessage.remoteHost
  • channels.imessage.remoteAttachmentRoots
  • gateway host에서의 SSH/SCP key auth
  • gateway host의 ~/.ssh/known_hosts에 host key가 있는지
  • Messages가 실행 중인 Mac에서 원격 경로를 읽을 수 있는지
같은 사용자/세션 컨텍스트의 대화형 GUI terminal에서 다시 실행하고 프롬프트를 승인하세요.
imsg chats --limit 1
imsg send <handle> "test"
OpenClaw/imsg를 실행하는 프로세스 컨텍스트에 Full Disk Access와 Automation이 모두 부여되었는지 확인하세요.

설정 레퍼런스 포인터