IMessage App Archives

IMessage App Archives

iMessage App Archives

iMessage App Archives

Here’s how you can access your entire iMessage history on your Mac

A very simple way to understand what a database file is is to think of it a a folder that contains a bunch of excel-like tables. Much like larger or enterprise-grade databases you can connect and access the data in the database in a variety of ways.

In this tutorial, I’m using Python and the amazing pandas module to connect to the database, explore the tables and data it holds and then read that data from the appropriate tables.

connection code
import sqlite3
import pandas as pd# substitute username with your username
conn = sqlite3.connect('/Users/username/Library/Messages/chat.db')# connect to the database
cur = conn.cursor()# get the names of the tables in the database
cur.execute(" select name from sqlite_master where type = 'table' ") for name in cur.fetchall():
print(name)

Above we connect to the database and explore what tables are in there. I found that there are a few tables in the database including one called message and others names chat, handle and attachment. Let’s explore the message table because that’s the one that sounds most promising to hold our iMessages. I do that by transferring the table into a pandas dataframe, a type of file that is much easier to explore and manipulate for data analyis projects.

# get the 10 entries of the message table using pandas
messages = pd.read_sql_query("select * from message limit 10", conn)

Getting the message text and phone number

We hit bingo! The message table indeed seems to hold all the saved iMessages. It has a text field with the actual sent or received message, a date field (more on that below) and a handle id. After a little exploration I found that the handle_id is a code for each phone number or Apple-id that you have had a conversation with. In order to map the handle_id back to the Apple-id we can use a table in the database (appropriately) named handle and join on handle_id.

# get the handles to apple-id mapping table
handles = pd.read_sql_query("select * from handle", conn)# and join to the messages, on handle_idmessages.rename(columns={'ROWID' : 'message_id'}, inplace = True)handles.rename(columns={'id' : 'phone_number', 'ROWID': 'handle_id'}, inplace = True)merge_leve_1 = temp = pd.merge(messages[['text', 'handle_id', 'date','is_sent', 'message_id']], handles[['handle_id', 'phone_number']], on ='handle_id', how='left')

Adding a chat id

Similarly, the message table also includes a chat_id that maps each message back to unique chat. This can be useful when doing analysis on chats with multiple people in them. We can get the chat_id of each message by joining the message table with the (again, appropriately named) chat_message_join table on message_id.

# get the chat to message mapping
chat_message_joins = pd.read_sql_query("select * from chat_message_join", conn)# and join back to the merge_level_1 table
df_messages = pd.merge(merge_level_1, chat_message_joins[['chat_id', 'message_id']], on = 'message_id', how='left')

Getting the date

The message table also includes a date column and this was a little tricky for me to decode since it isn’t exactly in any format that is widely used in the industry. Moreover, the way that this column is recorded is a little different in newer version of Mac OS X compared to older ones.

Credit to this stackoverflow page that helped me figure this out.

In Mac OS X versions before High Sierra (which is version 10.13 and released in September 2017), the date column is an epoch type but, unlike the standard of counting the seconds from 1970–01–01, it is counting the seconds from 2001–01–01. In order to convert that type into a data field we can actually comprehend we can use a command while querying the message table to create a new field (we will call it date_utc, since it is giving a UTC timezone date as a result) based on the date field.

# convert 2001-01-01 epoch time into a timestamp
# Mac OS X versions before High Sierra
datetime(message.date + strftime("%s", "2001-01-01") ,"unixepoch","localtime")# how to use that in the SQL query
messages = pd.read_sql_query("select *, datetime(message.date + strftime("%s", "2001-01-01") ,"unixepoch","localtime") as date_uct from message", conn)

In Mac OS X High Sierra and above, it’s the same thing but the date format is now much more granular: it is in nano-second level. So now we need to divide by before we apply the same code snippet we applied above.

# convert 2001-01-01 epoch time into a timestamp
# Mac OS X versions after High Sierra
datetime(message.date/1000000000 + strftime("%s", "2001-01-01") ,"unixepoch","localtime")# how to use that in the SQL query
messages = pd.read_sql_query("select *, datetime(message.date/1000000000 + strftime("%s", "2001-01-01") ,"unixepoch","localtime") as date_uct from message", conn)

Putting it all together

You can find the notebook here with all the code in order for you to extract your iMessages from your laptop and start analyzing!

It should only take a few minutes and by the end of it you should have a basic history of your iMessage data that includes the phone number (or email), the text, a unique chat for each unique group of people you had a chat with and the timestamp (in UTC timezone) of each message sent.

You can actually find more data in the database such as details if the message was delivered and read as well as attachments. I’m not touching on those attributes on this post.

This post also only instructs on how to get iMessage data from your Apple computer. If you have any pointers on how you can extract your iMessage history from Apple mobile devices (iPhone & iPad) let me know in the comments.

Happy reading your messages!

Источник: [https://torrent-igruha.org/3551-portal.html]
, iMessage App Archives

So you are trying to find your old messages or need to find an old iMessage attachment? Ir maybe you accidentally deleted an entire conversation in your Mac’s Message App and you want to see it.

For many of us Mac users, our messages and message histories are automatically saved on your computers. So finding that missing or old message just might be easier than you think!

Contents

Related Articles

Does My Mac Store My Text Messages and iMessage History?

On Macs using macOS Sierra and earlier, your computer by default stores all your iMessages on your hard drive.

And for new versions like macOS High Sierra and above, unless you sync with iCloud using Messages in iCloud, your Mac likely saves your messages too.

  1. To check, open your Message App and choose Messages > Preferences from the top menu
  2. Tap the General tab and see if you ticked the box for Save history when conversations are closed 
  3. If that’s checked, note how long your Mac keeps your message history in the Keep Messages drop-down. It’s either Forever, One Year, or 30 days (this option is only available on macOS)

If you set a limit on how long your Mac keeps messages, once you reach it, your Mac removes all outdated conversations including images and other attachments.

If you did not check the box for Save history when conversations are closed, your Mac deletes the conversations when you close them.

I Use Message in iCloud, Does My Mac Still Store My Messages?

Even if you enable Message in iCloud on your Mac, if you tick the box for Save history when conversations are closed, your messages still store on your Mac.

If that box is not ticked, then your message history is saved in iCloud only and not on your Mac. 

To use Messages in iCloud, you need macOS 10.13.5 or later and iOS 11.4 or later, and you need to be signed in to iMessage using the same Apple ID on every device where you want to use it.

How Do I Find My iMessage Archive and See Missing or Old iMessages on My Mac?

  • To access your past conversations, launch Finder > Go Menu 
  • Type in your user library using ~/Library and press the Go button
  • In the Library folder, choose the Messages Folder
  • You see two folders: Archive and Attachments along with file databases labeled chat.db

Don’t See Your Message Archive Folder?

If you cannot find your Message Archive folder in your User Library’s Message folder, it might still be located in an older OS X location:

~/Library/Containers/com.apple.iChat/Data/Library/Messages 

If you’ve upgraded a Mac many times from different versions of Mac OS X to macOS, your Message archive is often located in the iChat folder instead of your Messages folder.

iMessage files stored: The Good News

Your messages and photos, videos, or any other attachments automatically sync and store in ~/Library/Messages/Archives and ~/Library/Messages/Attachments.

  • The Archive Folder holds all your past messages from saved or closed conversations
  • The Attachments Folder has any images or videos from those iMessage conversations

Additionally, Apple places your iMessages in the chat.db items in ~/Library/Messages

  • The chat.db keeps all your iMessage data from all of your current and active message histories.

TextEdit or similar programs open these chat files, and some of the everyday languages are legible.

BUT there is a lot of other info that’s not readable.

Apple saves your conversations by each session, usually between each shutdown. Sleep and closing the Message app several times a day also creates additional sessions.

iMessage files stored: The Bad News

Unfortunately, the Attachment Folder is a backup for your iMessages and Message app.

And the interior folder names don’t make any logical sense–just a bunch of numbers, sometimes with letters

BUT, your images and videos are there. You just have to spend some time looking around to find the exact attachment, photo, or video you want.

Not Seeing Your Message Archive or Attachments?

If you aren’t finding your message archive or any message attachments, it’s possible that your Message App Preferences are set not to save your message history.

  1. To check, open Messages > Preferences and select the General Tab.
  2. Under Application, make sure the checkbox for Save history when conversations are closed is ticked.  

How To Transfer Old iMessages To A New Mac or MacBook?

For many people, their messages are a lifeline to their past. And when they purchase a new Mac or MacBook, they want to keep all of those messages and move them to their new computer.

And the good news is that it is indeed possible, with several options on just how to do it!

Transfer Messages From an Old Mac to a New Mac Using Messages in iCloud

The easiest way, if you Macs support it, is to transfer your message history using Messages in iCloud.

One of the best things about Messages in iCloud is that it syncs your message history between devices–as long as the Mac uses macOS 10.13.4 (High Sierra) and above.

Transfer Messages History to a New Mac With Library Folders

If your Mac(s) don’t support Messages in iCloud or you don’t want to use it, there is another option. Just copy and move your current User Library/Messages folder to the new Mac!

There are lots of ways to move the file, including AirDrop, File Sharing, a handy thumb drive, even DropBox or Google Drive.

Move Your Message History Folder to a New Mac

  1. On the old Mac, open up the ~/Library/Messages folder
  2. Copy that folder on to your method of choice (or drag it to AirDrop)
  3. On the new Mac, open that same location ~/Library/Messages
  4. If it’s empty, drag the older Mac’s Messages folder to that location
    1. If the new Mac’s Library/Messages folder is not empty
    2. Copy its contents by right-clicking and choosing Duplicate
    3. Move the copy to your Desktop or another place you’ll remember
    4. Then delete the original Messages folder
    5. Finally, drag the older Mac’s Messages folder to that location
  5. Restart your new Mac

Obsessed with tech since the early arrival of A/UX on Apple, Sudz (SK) is responsible for the editorial direction of AppleToolBox. He is based out of Los Angeles, CA.

Sudz specializes in covering all things macOS, having reviewed dozens of OS X and macOS developments over the years.

In a former life, Sudz worked helping Fortune 100 companies with their technology and business transformation aspirations.

Источник: [https://torrent-igruha.org/3551-portal.html]
iMessage App Archives

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Page content loaded

Nov 3, 2017 2:26 PM in response to Sweejak In response to Sweejak

Hi,

In Messages > Preferences > General Section there is an Option Save on Close

However the Delete that the "x" on mousing over the listing in the Side Bar seems to override this setting in Sierra upwards.

9:26 pm Friday; November 3, 2017

​  iMac 2.5Ghz i5 2011 (Sierra)
 G4/1GhzDual MDD (Leopard 10.5.8)
 MacBookPro 2Gb (Snow Leopard 10.6.8)
 Mac OS X (10.6.8),
 iPhone 6 iOS 11.x and an iPad (2)

Nov 3, 2017 2:26 PM

Nov 3, 2017 6:18 PM in response to Ralph Johns (UK) In response to Ralph Johns (UK)

I've been selecting the conversation, going to "print" and then saving as a pdf. That works rather well since apparently, there is no way to archive from within Messages.

Nov 3, 2017 6:18 PM

Nov 3, 2017 11:15 PM in response to tygb In response to tygb

Thanks, tygb. I don't have the option to save for a specified time, it seems that is new in High Sierra, I'm still in Sierra but this should solve my problem without resorting to the pdf route.

Nov 3, 2017 11:15 PM

Nov 3, 2017 11:32 PM in response to Sweejak In response to Sweejak

Another question, I closed about 3 conversations but how do I bring them back if I want to review or add to them?

Nov 3, 2017 11:32 PM

Nov 4, 2017 12:07 PM in response to Sweejak In response to Sweejak

Hi,

That's the trouble with the Sierra and High Sierra versions.

The x deletes them (and the Saved History).

7:07 pm Saturday; November 4, 2017

​  iMac 2.5Ghz i5 2011 (Sierra)
 G4/1GhzDual MDD (Leopard 10.5.8)
 MacBookPro 2Gb (Snow Leopard 10.6.8)
 Mac OS X (10.6.8),
 iPhone 6 iOS 11.x and an iPad (2)

Nov 4, 2017 12:07 PM

Nov 4, 2017 1:46 PM in response to Ralph Johns (UK) In response to Ralph Johns (UK)

Ok, but I only closed the conversations via the top menu, File> Close Conversation. Also on my laptop I am running the latest update of High Sierra and I see no drop down option to set how long to keep messages.
So this advice from Apple is just wrong: "Close a conversation: Move the pointer over the conversation, then click X." And the conversations I closed are now trashed?

Nov 4, 2017 1:46 PM

Nov 4, 2017 4:02 PM in response to Eric Root In response to Eric Root

So now, in Sierra and High Sierra, the X closes the conversation. How would I bring my closed conversations back up into Messages?

And I wonder if there is a reason why I don't have the option to designate how long I want my messages saved.

Nov 4, 2017 4:02 PM

User profile for user: Sweejak

Question:Q:How do I Archive "Messages" Conversations?

Источник: [https://torrent-igruha.org/3551-portal.html]
.

What’s New in the iMessage App Archives?

Screen Shot

System Requirements for IMessage App Archives

Add a Comment

Your email address will not be published. Required fields are marked *