23

How do you convert the iChat transcript files that Messages creates into human-readable text files that can be opened without the Messages app?

For reference, these are the conversation files located in ~/Library/Messages/Archive.

Simply opening the .ichat files in a text editor includes a bunch of additional strings and hashes. Opening them in Messages and copy-pasting into a text editor works, but I'd prefer to automate the process if possible.

9 Answers 9

14

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
1
  • But that's such a convoluted format that it's barely readable. Is there some kind of tool?
    – Alper
    Commented Mar 30, 2023 at 18:28
10

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.

1
  • 4
    iChat transcripts (.ichat files) are not SQLite databases. Commented Apr 29, 2015 at 15:55
7

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

5
  • 2
    Does it work with iChat log files?
    – nohillside
    Commented Jul 18, 2015 at 8:40
  • It uses your iChat log files found in your ./Library/Messages/chat.db to convert into a text file. Commented Jul 18, 2015 at 18:20
  • This worked nicely for me, thanks! I notice it can skip the very beginning of message histories though if you have conversations that are VERY long (unless they are forever lost if iMessage doesnt keep all messages like i thought). Nevertheless still got the job done! Commented May 12, 2016 at 13:04
  • I think the main problem I've noticed is that when you open your macbook after having sent many messages on your phone, there is that delay between iMessage on mac and phone, and this causes the messages to get cut off. Commented May 13, 2016 at 5:07
  • This looks very useful, but is there a way to delete older messages once they have been exported/archived/whatever ?
    – Paul R
    Commented Mar 27, 2017 at 21:39
1

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

1

For those with folders full of .ichat files on their hands, whether or not they're part of ~/Library/Messages, my project will instantly convert those to RTF or plain-text format: https://github.com/Amethyst-Software/convert-ichat-files (pre-built binary is provided). Basic messages as well as file transfer messages (not the files themselves) and chat client events are translated to text. Group chats are supported as well.

1

I've created an app called "Past for iChat" to do this (open iChats/Chat logs on macOS 11+ and export them in various formats): https://zeezide.de/en/products/past/

0

If you select print from the file menus, when the print box opens in the lower left is a pdf button with a drop down. From here you can save as pdf, post script, mail as pdf or send to iTunes.

-1

This wouldn't be a perfect solution, but I notice that the messages are always between Ä_ and _$. You could write a script to extract all the text which started and ended with those characters. (any language with rexex support would do)

-1

This seems like an ideal application of Automator workflows or AppleScript, since both of those can do "press buttons onscreen" style behavior. You'd say "take file as input," and use something under "print" or "messages" if there are either of those, or use AppleScript to tell it to open the file and press file and print and save as pdf and then close the file.

1
  • Could you provide a better description of your answer. That's suggestive but not showing any particular answer for the user with steps. Commented May 21, 2016 at 2:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .