How to sign in Messages app in Mac Mavericks from terminal
Messages supports AppleScript. You can view the Messages's AppleScript dictionary using the AppleScript Editor:

Applications &gt; Utilities &gt; AppleScript Editor.app


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


  log in v : 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'