Skip to content

Instantly share code, notes, and snippets.

@Mineinjava
Last active June 27, 2021 03:52
Show Gist options
  • Save Mineinjava/81cfc05db9f5128ef50bd027a0a97b48 to your computer and use it in GitHub Desktop.
Save Mineinjava/81cfc05db9f5128ef50bd027a0a97b48 to your computer and use it in GitHub Desktop.
iMessage Retriever Sql

execute the below sql on the ~/Library/Messages/chat.db to retrieve the most recent 10 messages (can be changed with the LIMIT keyword.

Adapted from NiftyCode's iMessage Reader

this file will only be present on MacOS

SELECT text, datetime((date / 1000000000) + 978307200, 'unixepoch', 'localtime'), handle.id, handle.service FROM message JOIN handle on message.handle_id=handle.ROWID ORDER BY message.ROWID DESC LIMIT 10;
SELECT
text,
datetime(
(date / 1000000000) + 978307200,
'unixepoch',
'localtime'
),
handle.id,
handle.service
FROM
message
JOIN handle on message.handle_id = handle.ROWID
ORDER BY
message.ROWID DESC
LIMIT
10;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment