iMessage is one of my favorite things about having an iPhone and a Mac. It’s also one of my least favorite things.
I love being able to send messages from my computer, and the integration between the two devices is seamless. What frustrates me is the inability to efficiently search through old messages. iOS 13 helped with this quite a lot (while still leaving something to be desired), but searching on your computer is basically worthless.
Fortunately, there is a relatively easy fix for this. If you use iMessage on your Mac, you can access the SQLite database where all of your messages are stored. With a little setup, you can use SQL’s raw power to look through your old messages.
1. Initial Setup
IMessage texts can include photos, videos, and other info. You can see when other people are typing, and send read receipts to let them know when you’ve read their messages. For security, messages sent using iMessage are encrypted before they’re sent. IMessage texts appear in blue bubbles, and SMS/MMS texts appear in green bubbles. The iMessage feature on your iPhone provides some additional messaging features that aren’t available with traditional SMS text messaging. This includes things like Apple Pay, animojis, and some other interesting options found in the Messages app. You can tell if you have sent an iMessage because the shading around the message will be blue. With the feature turned on, your trusted personal assistant will read an incoming message aloud, be it an iMessage or a text originating from a third-party messaging app, as long as it integrates with the personal assistant using Apple’s SiriKit APIs. Siri announces the sender before reading aloud the contents of their message into your ear. Ever notice how iMessage will mark a message as “Read” when the other person sees it? These are called “read receipts”, and they can provide a lot of peace of mind for those that you message with. But when exactly does the other person know that you’ve read their message?
Go reading and get the 3 ways to recover deleted iMessages from iPhone. How to Recover Deleted iMessages on iPhone Directly. Deleting or losing conversations in iMessages can be really frustrating especially when those important messages came from a special person or a group of people.
There aren’t any prerequisites to getting started (other than a Mac with iMessage). However, your mileage may vary depending on whether you are using a SQL client (I use TablePlus) or sqlite3 on the command line. The setup for both is similar.
The database is located at ~/Library/Messages/chat.db
. If you open a terminal and run ls ~/Library/Messages/chat.db
, you’ll get a message like: ls: Messages: Operation not permitted
. Similarly, if you try and open the database in a SQL client, you’ll likely see an error. We need to grant access first.
I’m doing this on macOS Catalina, which has added some additional security features (i.e., restrictions). Even so, it’s actually quite easy to get access to the database, as long as you don’t mind granting full disk access to some applications. Let’s get that out of the way right away.
Why Are My Imessages Automatically Being Read
Open System Preferences, find the “Security & Privacy” pane, click on the “Privacy” tab, and find the “Full Disk Access” item. Make sure your SQL client and/or terminal are selected.
That should be it! You’ll need to restart any applications that were open while you granted them access. Otherwise, you should be able to access the message database:
- In a terminal, run
sqlite3 ~/Library/Messages/chat.db
- In a SQL client, connect to the database at
~/Library/Messages/chat.db
. If you’re having trouble navigating to it, you can press CMD+SHIFT+G in a finder window and type that in the dropdown.
2. Exploring the Tables
When you open the database, you should see about fifteen tables. Yoshis island 64.
A few notable tables:
- attachment – metadata and storage location
- chat – a collection of your messages (both direct and group)
- handle – metadata about chats
- message – all messages sent and received
There are also join tables, which show the relationships between tables (handles to chats, chats to messages, messages to attachments, etc.). With these, we can build some pretty cool queries.
Why Are My Imessages Reading Themselves
3. Queries
To see all of your messages with a nicely formatted date:
To find a message that matches some text:
To see the total count of messages across all of your chats:
Canoscan d646u ex driver free download. To see some interesting information about messages between you and another person:
These are just a few examples of what you can do when you dig into the data behind your messages.
Sent As Text Message Imessage
Accessing the chat database can, of course, be useful for finding old messages. But more than that, it’s fun to explore and write some interesting queries. Let me know in the comments if you’ve written anything exciting for this database!