Is it possible to sign in Message app from terminal ? When I search for it, I only see on how to send imessage from terminal. Thus, how can I do that ?


Messages supports AppleScript. You can view the Messages's AppleScript dictionary using the AppleScript Editor:

Applications > Utilities > AppleScript Editor.app

The AppleScript command log in suggests you can sign in programmatically:

log inv : Log in to the specified service, or all services if none is specified. If the account password is not in the keychain the user will be prompted to enter one.

An example AppleScript to log in would be:

tell application "Messages"
    -- Log into every session
    log in
end tell

You can then use the osascript command line tool to issue AppleScript commands via the Terminal:

An example osascript command to log in would be:

osascript -e 'tell application "Messages" to log in'
  • Than you, Graham Miln. I will try it. I will confirm if it works soon. – Malin CHHAN Oct 9 '14 at 8:34
  • Do you have any example code for log in ? – Malin CHHAN Oct 9 '14 at 8:37
  • I can start with : using terms from application "Messages" on login finished with eventDescription end login finished – Malin CHHAN Oct 9 '14 at 9:06
  • I have added examples for AppleScript and osascript approaches. – Graham Miln Oct 9 '14 at 10:23
  • Thank again, Graham Miln. And can you tell me how I can put my apple ID and password to know it works well or not ? – Malin CHHAN Oct 9 '14 at 10:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .