Apple - How do I remove an iMessage account from OS X (Yosemite) Messages app?

OK, I figured it out but it's not straightforward. I figured it had to be stored in a .plist file somewhere, so I searched all the .plist files in ~/Library/Preferences for ones that contained the Apple ID I used for iMessages. These were the ones:

  • ByHost/

When I searched for on the web I found a link to a very useful answer on the Apple forums that also helped out.

So basically, this is what I did:

Delete the .plist files I mentioned above (note, the last one with the UUID in the name is likely to be different for each user):

cd ~/Library/Preferences
rm ByHost/

Then I removed all the chat history and archive:

rm ~/Library/Messages/chat.db*
rm -rf ~/Library/Messages/Archive
rm -rf ~/Library/Messages/Attachments

Then I restarted the Mac just in case. Now the account and everything about it that ever existed on this machine is gone :)