Monday, June 8, 2009

Safari 4.0 how to turn off Top Sites and reclaim CPU cycles

Safari 4.0 is out and it steals a lot of CPU if you're not careful. There's a process called Safari Webpage Preview Fetcher which grabs sites for Safari to take screenshots of in the background for Top Sites.

The problem is this background process can eat up to 10% of your CPU when it's running or more. This isn't good when you need every ounce of power out of your Mac while you render or perform Multiclip edits in FCP.

Worse still, is there is a folder at ~/Library/Caches/com.apple.Safari/Webpage Previews which will fill up with .png and .jpeg screenshots of websites you visit (or don't visit but have bookmarked). Not only is this a security risk, (it'll take screenshots of your web email) but it's messy, can eat up a LOT of hard drive space and keeps backup software needlessly busy.

Here's how to stop all this from happening.

Keep in mind Safari 4.0 only came out a few hours ago so this "fix" hasn't been tested in the long term. I'm trying it right now and so far things seem okay. The only caveat seems to be some sites never finish "loading" because they never have a screenshot taken of them. They do complete loading but you'll see spinning gears on some of their tabs.

1. Quit Safari 4.0 and right-click on it's icon in the Finder. Select "Show Package Contents".
2. Look inside the Contents folder and right-click on Safari Webpage Preview Fetcher and select Compress "Safari Webpage Preview Fetcher".
3. Put the original Safari Webpage Preview Fetcher in the trash and empty it.
4. Navigate to ~/Library/Caches/com.apple.Safari/Webpage Previews and highlight it. Get Info on it.
5. At the bottom click on the padlock, type in your password and then change the Privilege column for your login name to "Read only". Close the Get Info window.
6. Launch Safari.

Btw, a great way to stop ad sites is to set up and use OpenDNS. Also, if you dislike seeing ads in Safari you can install and try either of these: GlimmerBlocker or Safari AdBlock.

An alternate method has been emailed to me which I have not tried so use it at your own risk:

I can confirm that the following list of terminal commands works fine:
cd ~/Library/Caches/com.apple.Safari/
rm -rf "Webpage Previews"
ln -s /dev/null "Webpage Previews"

The only issue is that there is an error logged in the console for each website visited.


I haven't tried this as my method seems to be working so far. I think this is from the discussion forums at Apple. Unfortunately I can't credit the original poster as I'm not sure who it is.

UPDATE: Quit Safari toss this into the Terminal to effectively turn off Webpage Previews:

defaults write com.apple.Safari DebugSnapshotsUpdatePolicy -int 2

Then relaunch Safari.

To return to Safari generating Webpage Previews quit Safari then throw this into the Terminal:

defaults delete com.apple.Safari DebugSnapshotsUpdatePolicy

4 comments:

mike said...

How is this working out so far? Any problems? I'm concerned about the Gigs of cached images.

Thanks

Walker Ferox said...

So far so good.

The only issue is a cosmetic one as far as I can tell. Safari can never take the screenshot of the page so it thinks it hasn't finished loading some, but not all, pages so you'll see the Spinning Gear of Infinite Loading™ occasionaly.

There is an alternate method which I haven't tested which I'll add on to the post in a minute.

MS blog 2.0 said...

Any reason NOT to trash the jpg files at ~library/caches/com.apple.safari/webpage Previews?

Found 1000 files and dragged to trash. But now am nervous about having done so.

finding the lovely preview slows my computer to a crawl

Walker Ferox said...

I've trashed my preview images, both .jpg and .png and there have been zero problems.