Force Messages to Stay Logged in on OSX
You could run a script every minute to update the status to available.

To do this, save the following AppleScript, I called messages-available.scpt, but your can rename if you want.

tell application "System Events"
    tell process "Messages"
        tell menu bar 1
            tell menu bar item "Messages"
                tell menu "Messages"
                    tell menu item "My Status"
                        tell menu "My Status"
                                click menu item "Available"
                            end if
                        end tell
                    end tell
                end tell
             end tell
        end tell
    end tell
end tell


Give permissions: chmod 775 messages-available.scpt.

The script do click on Available menu item in Messages.

Go to folder /Users/your-username/Library/LaunchAgents and save there the following plist file. I named it com.username.messages-available.plist, but again, feel free to change it.

&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;
&lt;plist version="1.0"&gt;
&lt;dict&gt;
  &lt;key&gt;Label&lt;/key&gt;
  &lt;string&gt;com.your-username.messages-available&lt;/string&gt;

  &lt;key&gt;ProgramArguments&lt;/key&gt;
  &lt;array&gt;
    &lt;string&gt;/usr/bin/osascript&lt;/string&gt;
    &lt;string&gt;/Users/your-username/bin/messages-available.scpt&lt;/string&gt;
  &lt;/array&gt;

  &lt;key&gt;Nice&lt;/key&gt;
  &lt;integer&gt;1&lt;/integer&gt;

  &lt;key&gt;StartInterval&lt;/key&gt;
  &lt;integer&gt;60&lt;/integer&gt;

  &lt;key&gt;RunAtLoad&lt;/key&gt;
  &lt;true/&gt;

  &lt;key&gt;StandardErrorPath&lt;/key&gt;
  &lt;string&gt;/tmp/com.your-username.messages-available.err&lt;/string&gt;

  &lt;key&gt;StandardOutPath&lt;/key&gt;
  &lt;string&gt;/tmp/com.your-username.messages-available.out&lt;/string&gt;
&lt;/dict&gt;
&lt;/plist&gt;


The file is pretty self-explanatory. We will launch the command /usr/bin/osascript /Users/your-username/bin/messages-available.scpt every 60 seconds, will be launched at load, will save errors on /tmp/com.username.messages-available.err and logs on /tmp/com.username.messages-available.out.

Replace your-username appropriately.

Last step, tell the Mac launchd daemon to load it.

launchctl load com.your-username.messages-available.plist


To stop the script, just replace the word load with unload in the above sentence. When your restart your computer the script will be load again. To prevent it, move it to another folder.