If you know the iMessage account of your contact you can do following : `sqlite3 chat.db "select * from message where handle_id=((select ROWID from chat where guid='iMessage;-;+#########')-1)" | awk 'BEGIN { FS = "|"; } ; {print $17 " " $3}' | sed 's/^0/me :/g' | sed 's/^[0-9][0-9]*/him :/g'` Replace the `#####` by the iMessage account. In my case it is +33616.... (yes with the prefix) --- Explanation of the oneliner : 1. We need the handle_id of your contact in the DB. 2. The id has to be decremented 3. With the ID we can retrieve all the text in the DB 4. `awk` is just here to parse the message and who wrote that 5. `sed`is just here to replace the number retrieved by awk that do mean that much and replace them with "me" and "him".