Apple - How to seek to very old text messages

I found 2 ways of doing that. Depending on your needs and preferences, you choose what you want.

1. The flexible way

Open the Terminal.app And enter the following command:

sqlite3 ~/Library/Messages/chat.db

Now you are in the database of the Messages app of your mac.

Enter the following commands (but don't include the sqlite> as this one was added to this answer just to show you what you will expect at this point):

sqlite> .mode column
sqlite> .headers on
sqlite> SELECT text, datetime(date, 'unixepoch', '+31 year') AS cDate FROM message WHERE cDate >= "2016-01-12";

Replace this "2016-01-12" with the date you want to filter your messages, but keep the ""!

If you know the exact date of the message you can replace the >= with = like this:

sqlite> SELECT text, datetime(date, 'unixepoch', '+31 year') AS cDate FROM message WHERE cDate = "2016-01-12";

Or if you know a range of dates then you can also do this:

sqlite> SELECT text, datetime(date, 'unixepoch', '+31 year') AS cDate FROM message WHERE cDate >= "2015-12-10" and cDate <= "2016-01-12";

You should get your messages now filtered!

This way you can actually filter your messages in more flexible way. If you play around with the database schema, you may find a good way to filter your messages.

2. The easy way

If you want something more user-friendly then I found out that if you type this command in the Terminal.app:

open ~/Library/Messages/Archive/

Will open a folder in finder that has your messages grouped by date, which will make your life much easier, looking for your message. This has been mentioned by another user as well.

The advantage of this method, is that the messages are opened in a nice User Interface (i.e Messages) which is more readable and user-friendly.


For me, the easiest way I've found to search my messages, some of which go back years, is to use and continue to use iExplorer to export my Messages to various formats. I usually do PDF and TXT exports, either of which are then easily searched.

I make use of others features too and for me it was worth the cost, as it's not freeware.


I ended up getting the SQLite Browser and opening the ~/Library/Messages/chat.db file then searching and navigating through the texts there.

Tags:

Ios

Messages