How can I convert .ichat logs to text files?

Solution 1:

The files that Messages saves have an ichat file extension.

But from the command line you can inspect them to see they are actually binary plist files:

$ file transcript.ichat
transcript.ichat: Apple binary property list

Turns out, you can easily convert binary plist files into human-readable XML documents:

$ plutil -convert xml1 transcript.ichat

Now, when you run file again, you can see it's an XML file:

$ file transcript.ichat
transcript.ichat: XML document text

Go ahead—open it and see for yourself:

$ open transcript.ichat

Solution 2:

If you are familiar with sqlite, you can just export the messages directly from the database on Mountain Lion iMessage.

sqlite3 /Users/(username)/Library/Messages/chat.db

From the database, you can send sql commands to get any and all messages and associated fields you have interest. Further, you can change the output settings to write directly to a file.

Also, in addition to the database, all photos are stored in the Attachments folder.

Solution 3:

Check out my project that will take all of your conversations and convert them into one readable text file. It won't convert just a single iMessage, but it will collect all of your messages and attachments, back them up, and put them into a human-readable format.

https://peterkaminski09.github.io/baskup

Solution 4:

I've created a command line tool for converting these ichat files to newline-separated JSON

The tool extracts the bare essential information: message, sender, date

You can view the source code and/or download binary at https://github.com/kfatehi/ichat2json