Restore Messages using Time Machine (not iCloud synced) I've made a stupid misclick and deleted 4 years worth of Messages conversation with my significant other. They're not synced to iCloud, but I do have a recent Time Machine backup. I thought I could restore it from there, and I followed older how-to's (older because they are about iMessages, and I am using Messages on Big Sur).
What I've tried:

close Messages
restore the whole Library/Messages folder from Time Machine
reopen Messages

Not only did it not work, but it screwed up absolutely all conversations as well. Now, every time I click on a contact's conversation, it disappears. It's like they're in cache, but it can't find them in the database when it tries to load them in full.
So: how do I restore my Messages database from a Time Machine backup?
OK I've tried a few different things, and I've got something that works. There are two key points:

You need to restore the whole Library/Messages folder (not just chat.db, as is said in most how-to's)
Before you do this, you need to close Message. But also, after you restore, you need to reboot the Mac.

Doing all of these things (close, restore whole folder, reboot) means that when you restart and open Messages, your backed-up version is present and functional.
Phew!