Glossary/Processes you will see

IMDPersistenceAgent

Also: Messages database

Quick answer

IMDPersistenceAgent is the macOS process that reads and writes the Messages database, the file on your Mac that holds your iMessage and text message history. Messages, notifications, Spotlight and Siri all ask it for conversations instead of opening the database themselves.

It runs under your own user account, and macOS starts it whenever something needs your messages: opening the Messages app, a new message arriving, or a search that includes conversations. The history it looks after is kept in ~/Library/Messages in your home folder.

Most of the time it uses no CPU at all. It is busy for a moment when a message arrives, and for much longer when the whole history has to be gone through at once.

Why IMDPersistenceAgent is using so much CPU

The usual cause is Messages in iCloud catching up. After you sign in on a new Mac, turn the feature on, or come back from a long time offline, years of conversations and attachments are downloaded and written into the database, and IMDPersistenceAgent does the writing. With a large history this can take hours.

Spotlight indexing your conversations after a macOS update has the same effect, and so does a database that has grown very large or been damaged, where every request takes longer than it should.

What to do about it

If you have just set up the Mac or signed in to iCloud, leave it plugged in and let it finish. To see whether a sync is running, open Messages → Settings → iMessage; a sync in progress is shown there, and Sync Now starts one that has stalled.

If it stays high for more than a day, quit Messages and restart the Mac. If that does not settle it, turn Messages in iCloud off and on again in the same settings pane, which makes the Mac download its copy afresh. Do not delete files in ~/Library/Messages by hand unless your messages are safely in iCloud or in a backup.

Questions people ask

What is IMDPersistenceAgent on Mac?

The macOS process that manages your Messages history. Every app and system feature that shows or searches your conversations gets them through it.

Why is IMDPersistenceAgent using high CPU?

Usually because Messages in iCloud is syncing a large history, or Spotlight is indexing your conversations after an update. Both end on their own. A very large or damaged Messages database can keep it busy for longer.

Is it safe to quit IMDPersistenceAgent?

Yes. Force quitting it loses nothing, and macOS starts it again the next time something needs your messages. If a sync was running, it carries on from where it stopped.

Related

Looking for something better than Activity Monitor? See the best Activity Monitor alternatives for Mac, or browse every term in the glossary.