Totally awesome software for iPhone and OS X

Friday, March 20, 2009

Strange Safari behaviour...

For a few weeks now my Safari has hung on startup. Spinning beachballs of doom and everything. I figured it was something I'd done to it (I'm tracking the WebKit nightly releases and tend to hack around a bit with my OS) but never really had much time to figure out what exactly was going wrong.

Until now. I knew it was hanging on opening a file (I assumed the PubSub database and had tried deleting that to no avail), but this morning I decided that the PAIN of using firefox was too great to not spend half an hour fixing Safari.

After a bit of tinkering with lsof and gdb I discovered a couple of caches that I didn't know about on my machine these were..

/private/var/folders/gc/gcMtdPw4FY4KstxwBSOd7U+++TI/-Caches-/com.apple.Safari/Cache.db


and

/private/var/folders/gc/gcMtdPw4FY4KstxwBSOd7U+++TI/-Caches-/com.apple.Safari/SafeBrowsing.db


They were also huge. I've no idea what they were but I do know that when either Safari or Webkit starts up it tries to read them and on my machine this was causing it to hang (perhaps they were corrupt).

Anyway, the fix was to delete them (and the pubsub database for good measure). Steps below.

1. sudo rm -rf /private/var/folders/gc/

2. rm ~/Library/PubSub/Database/Database.sqlite3

After these two steps both Safari and WebKit work and I'm finally out of Firefox purgatory. I hope this comes in useful if anyone else has Safari hanging on startup.

1 comment:

Kirsch said...

It'd be nice if all programs, especially Apple ones, put their caches in
~/Library/Caches/

At least that way you can be sure that it's safe to delete them,

© 2007 Wired Up And Fired Up