Like everyone else who uses Apple's Messages app, I have a chat.db file. I'd like to read the file but nothing seems to yeild the expected results.
Here is what I've tried so far:
-
The CLI approach of cd to
~/Libray/Messages
followed byopen chat.db
was amongst the best in that something was found and there was an attempt to open the file. Unfortunately, it didn't work as hoped. -
Since I now had the db browser for SQLite open, I tried to open the file via that app's gui but because the folder is hidden one, it didn't show.
Has anyone had any success with this? I certainly can't be the first person to have tried and I've seen elsewhere the schema may also be an issue.
Best Answer
The file you have found is a SQLite database and you need an application which can read SQLite databases. You have many choices - search in the Mac App Store for SQLite (or similar) or use the Terminal command
sqlite3
.But a SQLite database is not simple. It is a series of interrelated tables. Connections between the tables define relationships and hence the term "relational database". SQLite are perhaps the simplest of SQL relational databases, but even so they are intimidating to the first time user.
To make sense of a SQLite datebase you need:
Steps to read chat.db:
Copy and paste
I can then see all my messages (I have squashed up some of the columns to partially hide my content):
You can use different applications - I have used dbHarbour (free, I think).
Or you can do it in Terminal with a few simple commands:
The mode and output commands make sure that the output goes to a CSV file which you can open in a spreadsheet. The query is exactly as before.
That is a rather deep plunge into SQLite. Best of luck.