This tool exports your Messages database and attachments as a text file or webpage

A new free command-line tool exports your iMessage chats, SMS texts and attachments in plain text or HTML format for easy searching and backup.

Browsing exported iMessages as a webpage
Browsing exported iMessages as a webpage | Image: Christopher Sardegna/GitHub
  • A free new open-source utility, dubbed imessage-exporter, can conveniently export all your iMessage and SMS conversations and attachments.
  • The entire Messages app database can be exported in plain text format (TXT) or as a webpage (HTML) for easy reference, searching and backup.
  • Exporting the Messages app database in HTML allows you to browse your exported conversations and attachments in a web browser like Safari.

Introducing imessage-exporter

As noted by MacGeneration.fr, once you have your iMessage data exported in either TXT or HTML format, it’s super easy to browse your chats in Safari.

As Apple’s Spotlight search feature indexes both text files and webpages saved locally on the disk, you can quickly find any iMessage chat by keyword.

How to save your iMessage data with imessage-exporter

Running the imessage-exporter utility in macOS Terminal
imessage-exporter is a command-line utility | Image: Christian Zibreg/iDB

As a command-line tool, imessage-exporter is executed through the Terminal app on your Mac. It’s available to download from GitHub in two versions—one is for Apple silicon Macs (“aarch64”) and the other is for Intel-based Macs (“x86_64”).

Once you have the correct version installed, run the following Terminal command to export your iMessage database as a text file:

imessage-exporter -f html

Running this command will save your Messages conversations and attachments as separate HTML files within the ~/imessage_export/ folder on your Mac.

To export the Messages database as a TXT file instead:

imessage-exporter -f txt

Depending on the size of your Messages database, exporting all your conversations and attachments may take a while. You’ll lose styling (bold, italics, etc.) by exporting in plain text format, but metadata like date stamps and reactions will be retained.

Exporting as TXT instead of HTML is much faster, but keep in mind that no attachments will be saved in this format and chats won’t retain styling.

For further information, read the GitHub documentation.

How’s imessage-exporter useful?

The results of the iMessage-exporter tool showing both iMessages and SMS texts
Both SMS and iMessage are supported | Image: Christopher Sardegna/GitHub

Importantly, this tool wasn’t conceived as a way to back up your iMessages database, although nothing precludes you from using it for that purpose.

There are better ways to browse and back up your iMessage chats, like iMazing. But the beauty of imessage-exporter is that it exports the Messages database in file formats that work out of the box without needing any particular app.

Besides, imessage-exporter is a convenient way to gather, search and reference any images, videos and other attachments sent via iMessage. You can also browse iMessage attachments in the Messages app, but the process is cumbersome.

Helpful Messages tutorial