Restore OS X iMessages History from chat.db
Solution 1
After banging my head on it for 3 days - I've found out the following:
All those 3 files keep an index of what you have in Archives. So removing corrupted files and/or just restoring backup of these 3 files should have done it. But it didn't. I've tried restarting Messages app a thousand times after replacing those files, to no avail. Until I've decided to run lsof
to see what is actually using chat.db
. To my surprise it was not Messages app:
[none-none][18:42:24] vlazarenko@alluminium (~/Library/Messages)$ lsof -n | grep chat.db
IMDPersis 1655 vlazarenko txt REG 1,3 32768 107632436 /Users/vlazarenko/Library/Messages/chat.db-shm
IMDPersis 1655 vlazarenko 4u REG 1,3 309032 107632435 /Users/vlazarenko/Library/Messages/chat.db-wal
IMDPersis 1655 vlazarenko 5u REG 1,3 4096 107632432 /Users/vlazarenko/Library/Messages/chat.db
IMDPersis 1655 vlazarenko 6u REG 1,3 32768 107632436 /Users/vlazarenko/Library/Messages/chat.db-shm
As you can see, it's a process called IMDPersis
something.. Looking for that one:
[none-none][18:57:10] vlazarenko@alluminium (~/Library/Messages)$ ps -ef | grep IMDPersis
501 1655 1 0 6:48PM ?? 0:00.11 /System/Library/PrivateFrameworks/IMDPersistence.framework/XPCServices/IMDPersistenceAgent.xpc/Contents/MacOS/IMDPersistenceAgent
An a-ha! moment. Quitting Messages, replacing the files, doing kill
on the PID of IMDPersistenceAgent
and then starting Messages got me my history back in no time.
Thought I'd share, albeit this is an old thread.
Solution 2
There is some helpful information on the Apple discussion forum.
Basically, just need to move a backed-up ~Library/Messages
folder to replace the new empty ~Library/Messages
folder.
It may be that chat.db
, chat.db-shm
and chat.db-wal
files are linked together with keys etc., so that may be the reason iMessages is not accepting the changes.
https://discussions.apple.com/thread/5378830
nodebase
Updated on June 05, 2022Comments
-
nodebase almost 2 years
I saved a copy of everything inside
~/Library/Messages/
which included a folder namedAttachments
that is filled with a bunch of subdirectories containing all my files ever attached to a message (images, documents, movies, etc), and three (3) files named:chat.db
(about 20 MB file size),chat.db-shm
(33 KB), andchat.db-wal
(565 KB).
I opened the large
chat.db
file and it contains all my messages in an SQLite database. I know this file contains all the information needed to rebuild my iMessage history, I'm just not sure how to convince the iMessages.app to do so.I've been at this for about 60 minutes now, trying several different things (I'm not going to list out every one of them).
There's gotta be a way to restore my messages from these files that I saved.