By now this is a pretty well known bug that if you type in file:/// (f in caps) in a lot of OSX apps, it will crash it. If you haven’t heard, see here or here or here. The worst part about this is someone could easily perform a denial of service attack on your iMessage app on any of your OSX machines by just sending you a quick message with 8 characters. You can try it right now as well……Oops, did I forget to mention? You will also send your own iMessage into a frezny crash loop…..

If you google around how to fix this, most blog posts would suggest you go and delete anything that starts with ‘chat’ in your ~/Library/Message folder (for example, Gizmodo). I would advice against it unless you don’t care about your chat history being completely erased. With a little terminal and sql you can easily fix it without having to remove your entire chat history.

The idea is pretty simple. The chat.db file that you were told to remove contains your chat history for iMessage. Instead of deleting the whole thing, you simply need to delete the culprit chat message that crashed your iMessage. We can easily do this with sqlite3 and a couple simple sql commands. Let’s get crackin.

So let’s fire up that terminal and type in:

cd ~/Library/Message

This will bring you to your Message folder. If you run the command ‘ls’ in the terminal you will see a chat.db file, that’s the file we DO NOT want to delete. The .db file extension tells us this is a database file, and in this case, it is an sqlite database file. So we can use sqlite3 to read the contents. (NOTE: if you run sqlite3 and get a ‘command not found’, then please google around on how to install sqlite3 in your terminal.) So lets fire up sqlite3:

sqlite3 chat.db

You should see an sqlite3 prompt appear that looks like this:

sqlite> 

This is where all the fun begins. Since this won’t be a blog post about sql, I’ll cut to the chase and show how to remove the culprit message. However, if you know sql queries, you pretty much and poke around here and do whatever you like. To delete the message that crashed iMessage, simply type this in the sqlite3 prompt:

sqlite> delete from message where text LIKE '%File:///%';

This will find and delete the individual messages that contain the text file:/// (with capital f). Now just use ctlr+d to exit out of sqlite3 and open up iMessage, you should be good to go!

blog comments powered by Disqus

my pic Isaac Liu is currently a software engineer at Apple Inc. working on the iOS performance team. He received his Ph.D in Electrical Engineering and Computer Science at the University of California, Berkeley . His research focus was in real time systems, parallel architectures and programming models. His thesis can be found here
read more…

office 2 Infinite Loop, Cupertino, CA
email liu (dot) isaac (at) gmail (dot) com
cv html / pdf [ updated: 9/05/11 ]
others facebook linkedin twitter picasa github

Recent Blog Entries

Archive...

Tags