Where Messages keeps your texts on a Mac
Messages on the Mac stores your conversations in one database file, chat.db, in the Messages folder of your user Library: ~/Library/Messages/chat.db. Photos, videos and other attachments are in ~/Library/Messages/Attachments. macOS protects this folder: only apps you give Full Disk Access can read it.
Updated
The files
| File or folder | What it holds |
|---|---|
chat.db | An SQLite database: every message, conversation, phone number and email address, and the links to attachments |
chat.db-wal, chat.db-shm | Working files SQLite uses for recent changes not yet merged into chat.db. The three belong together; copy all of them or none |
Attachments/ | Photos, videos, voice messages and files, in numbered folders |
How to open the folder
- In the Finder, choose Go › Go to Folder… (⇧⌘G).
- Type
~/Library/Messagesand press Return. - Look, but don't move, rename or edit anything: Messages uses these files all the time.
What is inside chat.db
- Tables.
messageholds the messages,handlethe phone numbers and email addresses,chatthe conversations,attachmentthe files; join tables connect them. - Times. A message's
datecounts nanoseconds since January 1, 2001, in universal time (seconds on macOS versions before 10.13). Read times, edit times and unsent times are stored the same way. - Text. Since macOS 13 the
textcolumn is often empty; the words are inattributedBody, an archived formatted string in an old binary format, together with mentions and links. - Edits, reactions, replies. Edited and unsent parts are in
message_summary_info; a reaction is a message of its own that points to the one it reacts to, and a reply names the message that started its thread.
If you are comfortable in Terminal, you can look without changing anything: give Terminal Full Disk Access, then run sqlite3 -readonly ~/Library/Messages/chat.db "select count(*) from message;". Reading the actual texts takes decoding that plain SQL can't do.
Reading it safely
An app that wants your messages needs only to read these files. Textbound opens chat.db in read-only mode, in place, so it can't change it, makes no copy of it, and decodes the text with its own decoder. It reads Contacts the same way, to show names next to numbers. It shows each conversation as it looks in Messages and exports it as a PDF, a web page or a CSV. Nothing is uploaded.
Free for the newest 100 messages of any conversation · macOS 14 or later
Questions
Where are iMessage attachments stored on a Mac?
In ~/Library/Messages/Attachments, in numbered folders. Files kept only in iCloud aren't there until Messages downloads them.
Can I copy chat.db to another Mac?
It isn't a good way to move messages: the database belongs to that Mac's Messages, and a copy made while Messages runs can be incomplete. Turn on Messages in iCloud, or move everything with Migration Assistant.
Why can't an app read my messages without Full Disk Access?
macOS keeps the Messages folder off-limits to every app, Terminal included, until you allow it in System Settings › Privacy & Security › Full Disk Access. That protects your messages from apps you didn't choose.
Is chat.db included in a Time Machine backup?
Yes, Time Machine backs up your Library, Messages included. A backup can be restored, but it isn't a copy you can read; for that, export the conversations you want.
Where are messages stored with Messages in iCloud on?
In iCloud, and on each device that has them. chat.db is then the Mac's local copy, kept in step with iCloud.
Open your Messages history in Textbound
Related: Full Disk Access, explained · back up your iMessages · get iPhone messages on the Mac