(This post was written when I had an iPhone 3G. SMS conversations may no longer be extractable in this format, but I will leave the post up until I know otherwise.)
I recently wanted to extract an SMS conversation from my phone so I could write a document based on it. Using a free backup extractor and the SQLite database program that comes pre-installed on OS X, I was able to dump the conversation into a spreadsheet in less than five minutes. You’ll need to have synced your phone with your computer first, as the extractor gets the SMS archive from the phone backup made by iTunes.
Note that these instructions are only applicable to Mac OS X, and the extractor requires Leopard. I found the SQLite commands in an excellent Google Code article, but that method required that I jailbreak my phone and install an SFTP server, which interested me not at all.
- Download the free iPhone/iPod Touch Backup Extractor program from SuperCrazyAwesome.com.
- Run it. The program will give you a list of available iPhone backups that iTunes has made when you sync your phone with your computer. Choose the latest one.
- From the list of apps whose data you could extract, choose “Other Programs” at the bottom. Choose a folder on disk to extract the data to — it will make a number of folders and files, so you should create a new folder for it.
- Open Terminal. Change your current directory to “Other Files/Library/SMS” within the folder that you chose in the previous step.
- Type the following commands, hitting the return key after each:
SELECT * FROM message;
You can now close Terminal. In the “Other Files/Library/SMS” within the folder to which you extracted the backups, there is now a file called output.txt. This is a pipe-delimited text file that you can import into Excel. Some of the columns are easily recognizable — the phone number to which the text message came from or was sent to, and the text of the message. To get all of the messages exchanged with a particular person, simply sort by the phone number column to get them all together.