Everywhere All articles Download Buy — $19

Where apps hide your files

The Messages chat.db file and its folder

Updated 2026-10-28 · 6 min read

Your iMessage and SMS history on a Mac lives in one database file, chat.db, in a protected folder inside Library. Here is where it is, how Messages in iCloud fits in, and the safe ways to keep a copy.

The location

~/Library/Messages/chat.db

That is the Messages database on recent macOS releases: your iMessage and SMS history, with the text of each message, who it was with and when. Two companion files sit beside it, chat.db-wal and chat.db-shm, which SQLite uses for changes not yet merged into the main file. On the Mac used for this guide the folder looks like this (sizes and names only, nothing was read):

ItemSize or role
chat.db331 KB
chat.db-wal, chat.db-shm32 KB each
DraftsUnsent drafts
NickNameCacheCached shared names and photos
CollaborationNoticeCacheCache for shared-file notices
Syncsync.db, used for syncing
LiteSegmentStore.dbA small store used by the app

Apple does not document these files, so the table describes one Mac, not a specification.

Where attachments are

The usual home for photos, videos and files people sent you is:

~/Library/Messages/Attachments

On the Mac used for this guide that folder does not exist, so expect it to be missing on a Mac that holds no attachments locally. Third-party guides and developer write-ups describe it as the standard location. Individual files sit in numbered and hashed subfolders and keep their original names, rarely the sender's name. A separate post covers finding them.

Open it

The folder is inside the hidden Library, and macOS protects ~/Library/Messages. In Finder press ⇧⌘G, type ~/Library/Messages and press Return. In Terminal:

open ~/Library/Messages

If a Terminal command such as ls ~/Library/Messages says "Operation not permitted", Terminal needs Full Disk Access. Open System Settings > Privacy & Security > Full Disk Access, switch Terminal on, then quit and reopen it. Full Disk Access is broad, so grant it only to apps you trust and consider turning it off again afterwards.

Messages in iCloud

If you use Messages in iCloud, your history lives in iCloud and each device keeps a local copy, so chat.db is that copy. Apple's steps on a Mac are: open Messages, choose Messages > Settings, click iMessage, and select Enable Messages in iCloud. Apple says the Mac then updates automatically, and Sync Now in the same pane pulls texts from your other Apple devices, for example after you switch to a new Mac. It may take a while for everything to appear. When you turn it off, Messages offers to do so for just this Mac or for all your devices, and says your Messages data is downloaded to the device and stops syncing to iCloud.

What deleting does

Apple's Messages guide is explicit:

Check Keep messages first if old history seems to vanish on its own.

Keep your history

The supported choice is Messages in iCloud, plus an ordinary backup. Time Machine includes ~/Library, so chat.db and Attachments are in your backups unless you excluded them.

If you want a separate copy of the Mac's files:

  1. Quit Messages (⌘Q).
  2. Copy chat.db, chat.db-wal and chat.db-shm together, and the Attachments folder if present, to an external drive in Finder.
  3. Treat the copy as a safety net, not a restore method. Apple does not document putting chat.db back, never do it while Messages is running, and with Messages in iCloud on an older database can conflict with what iCloud holds once Messages syncs again.

A copy of chat.db is a database, not a readable archive. Double-clicking it will not show conversations, and nobody should open it in an editor or edit it. Tools that read it work on a copy and need Full Disk Access, which is broader than Messages access. Apple's Messages guide does not describe a one-click export of full history.

Moving to a new Mac

Two routes are dependable. If you use Messages in iCloud, turn it on for the new Mac under Messages > Settings > iMessage and wait for it to download, using Sync Now if it stalls. Otherwise, use Migration Assistant or a Time Machine restore when setting up the new Mac, which brings your Library across. Copying chat.db into a Mac you are already running Messages on is not a route Apple documents, and with Messages open it can conflict with the live database.

Space

Attachments are usually the part that grows. Apple's way to clear them in bulk: select a conversation, click the Info button in the top-right corner, scroll to a category such as Photos, click Show more, Shift-click the items, Control-click them and choose Delete. They then sit in Recently Deleted for up to 30 days unless you remove them there. Removing files from Attachments by hand leaves conversations showing missing media. Use du -sh ~/Library/Messages/* (read only) to see which part is large.

What not to do

Why a normal search misses it

~/Library/Messages is protected by macOS and hidden inside Library, so Spotlight and Finder searches leave it out. Messages stores its text inside one database, so searching Finder for a phrase from a chat finds nothing in that folder. Messages' own search field searches message text.

Finding it again

Type chat.db into Everywhere to find the database and its -wal and -shm companions, or type a photo's file name to find a saved attachment inside Attachments. ~/Library/Messages is a protected folder, so Everywhere finds these once it has Full Disk Access. It matches names only and never reads your messages, and ⌘↵ reveals the file in Finder.

Common questions

Where is chat.db on a Mac?

At ~/Library/Messages/chat.db, with chat.db-wal and chat.db-shm beside it. macOS protects that folder, so Terminal needs Full Disk Access to list it.

Where are iMessage attachments stored on a Mac?

Usually in ~/Library/Messages/Attachments. On some Macs that folder does not exist until attachments are stored locally, so check the folder rather than assume it.

Is chat history stored in iCloud or on my Mac?

Both, if Messages in iCloud is on: the history lives in iCloud and the Mac keeps a local copy. Turn it on under Messages > Settings > iMessage > Enable Messages in iCloud.

How do I back up Messages on a Mac?

Time Machine includes the Library folder, and Messages in iCloud keeps another copy. For a manual copy, quit Messages and copy chat.db with its -wal and -shm files and the Attachments folder.

Find any file before you finish typing

Everywhere keeps track of every file on your Mac — including the folders Spotlight hides and drives you have unplugged. Free for a day, then $19 once.

Version 2.20.3 · macOS 13+ · 4.7 MB · notarised

Related

© 2026 Caretopia Network Private Limited Everywhere for Mac Buy a licence Articles Privacy Support