Update: Nino (see comments) has written a blog post on how to automate this a little, read it at http://rubyengineer.com/posts/2
If you have an issue with Messages on OSX being stuck in ‘Offline’ mode that won’t connect, open up Terminal and type the following:
ps auxwww | grep imagent
This will give you output similar to:
scott 341 0.0 0.3 2502924 12828 ?? S 1:41pm 0:04.75 /System/Library/PrivateFrameworks/IMCore.framework/imagent.app/Contents/MacOS/imagent scott 23666 0.0 0.0 2432772 460 s003 R+ 9:25am 0:00.00 grep imagent
The number you’re looking for is 341, which is the process ID of
kill -9 341
and the process will be restarted, allowing you to change status to online.