Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Cached 'favicons' in Safari can cause slowdowns Web Browsers
Anyone else notice that Safari has been getting slower and slower over time? In my case the most striking example was that I became unable to open a page in a new tab without getting a beach ball until it finished loading. This was happening on 2 machines since I upgraded to Panther (both clean installs) and I even got so frustrated I completely reinstalled Panther on one of the machines. It appears that Safari's declining performance isn't attributable to poor engine performance, so much as a lack of proper garbage collection.

Over time, Safari stores more and more info in your user's Library/Safari folder. Even though you can "reset" Safari, this doesn't clean up everything. In my case, the offending garbage was the "Icons" folder that stores every favicon you have ever come across. I manually deleted this folder, which removed hundreds of files and folders from my machine and Safari. Once they were trashed, Safari was back to it's old speedy self.

It would be nice if Apple could add some garbage collection to clean this up, but until then you can manually delete it or write an AppleScript to do it for you.
    •    
  • Currently 2.80 / 5
  You rated: 2 / 5 (10 votes cast)
 
[62,898 views]  

Cached 'favicons' in Safari can cause slowdowns | 32 comments | Create New Account
Click here to return to the 'Cached 'favicons' in Safari can cause slowdowns' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Cached 'favicons' in Safari can cause slowdowns
Authored by: newillmeister on Mar 29, '04 11:11:39AM

If you set the Icon folder to 'READ ONLY' it keeps Safari from saving those files...



[ Reply to This | # ]
Cached 'favicons' in Safari can cause slowdowns
Authored by: at_sym on Mar 29, '04 11:15:52AM
There's an earlier hint about blocking favicons by locking the folder here

[ Reply to This | # ]
Cached 'favicons' in Safari can cause slowdowns
Authored by: Felix on Mar 29, '04 12:07:46PM

Trashing that folder did seem to make some difference. It was almost 11MB on my HDD! How could favicons accumulate that much space? I thought they were one of two k each.



[ Reply to This | # ]
Cached 'favicons' in Safari can cause slowdowns
Authored by: Crimson Napkin on Mar 29, '04 12:14:31PM

I am so glad to see this post! I was just starting to get quite irritated/worried about how slow Safari has gotten (especially since I upgraded to 10.3.3). I was wondering what in the heck the problem could be and then I cam across this post... thanks macosxhints!

---
macosxhints.com is one reason PC users should switch to a Mac.



[ Reply to This | # ]
Cached 'favicons' in Safari can cause slowdowns
Authored by: beanboyrjs on Mar 29, '04 01:57:35PM

I was beginning to use Firefox instead of my preferred Safari because I was also getting pretty ticked that Safari was giving me that damn beach ball every time I click a link or opened a tab. Now I can go back to Safari! I was so glad for this hint.

Now...Apple, get on the 'beach' ball, and get this fixed!



[ Reply to This | # ]
Cached 'favicons' in Safari can cause slowdowns
Authored by: Crimson Napkin on Mar 30, '04 09:39:02AM

Me too! I had started using the daily Camino build and sometimes Mozilla but wasn't happy about this. After getting rid of the icons, I have not had one spinning beach ball.

---
macosxhints.com is one reason PC users should switch to a Mac.



[ Reply to This | # ]
Cached 'favicons' in Safari can cause slowdowns
Authored by: Gigacorpse on Mar 29, '04 12:18:44PM

Since I totally do not care about favicons, couldn't I just create an Applescript to delete them and have it run as a LoginItem? That would seem to take care of it.



[ Reply to This | # ]
Cached 'favicons' in Safari can cause slowdowns
Authored by: Nugget on Mar 29, '04 12:40:52PM
You can easily purge the unused icons from the cache with the following command from Terminal.app:

find $HOME/Library/Safari/Icons -type f -atime +30 -name "*.cache" -delete

I added this to my crontab to run every night. It purges any cached icons which have not been accessed in the past 30 days.

This seems like best compromise. It keeps the cache small, but still keeps the more useful favicons.

[ Reply to This | # ]

Adding Cron Jobs?
Authored by: klanda on Mar 29, '04 01:30:09PM

Is there a hint on here somewhere about how to add jobs to the cron file?

K

---
-------
.sig



[ Reply to This | # ]
Adding Cron Jobs?
Authored by: FlashBIOS on Mar 29, '04 03:00:34PM
There are two:
One
Two

[ Reply to This | # ]
Cached 'favicons' in Safari can cause slowdowns
Authored by: macfeller on Mar 29, '04 02:05:34PM

When I try the command nothing happens; the prompt merely returns. Not knowing anything really, I thought that I should substitute my actual home directory name for the word HOME. Nada. I get no such file or directory. Yes, there is the directory. Not sure if I even have a problem: I had not noticed a slowdown; the file is only 1.3 MB.



[ Reply to This | # ]
Cached 'favicons' in Safari can cause slowdowns
Authored by: FlashBIOS on Mar 29, '04 02:42:32PM
It should just return to the prompt with nothing "visibly" happening. Behinds the scenes the command finds all files (-type f) in your home's Safari icon folder ($HOME/Library/Safari/Icons) that were last accessed more than thirty days ago (-atime +30) whose name ends with .cache (-name "*.cache") and then deletes them (-delete). If you want to see something try changing the +30 to +2 and not including the -delete option. That would show all icons that haven't been accessed in the last two days. BTW, $HOME will work. It is a shell environmental variable -- think built into the command line. To try it out type echo $home and you should see the path to your home folder.

[ Reply to This | # ]
Cached 'favicons' in Safari can cause slowdowns
Authored by: macfeller on Mar 29, '04 06:40:50PM

Thanks for replying. Still no luck. When I do it and nothing happens but the prompt returning, the file is unchanged. When I changed the 30 to 2, the file is still the same. Finally, when I do echo $home, nothing again happens. TThe prompt merely returns. No file or pathway listing shows. I am logged in as an administrator user. It's not so much that I can't get it to work. It's that it doesn't and I don't know why. So it goes.



[ Reply to This | # ]
case matters
Authored by: hayne on Mar 30, '04 01:52:50AM

Make sure you use $HOME, not $home



[ Reply to This | # ]
case matters
Authored by: macfeller on Mar 30, '04 12:40:25PM

did that

nope



[ Reply to This | # ]
Cached 'favicons' in Safari can cause slowdowns
Authored by: ces3001 on Mar 29, '04 02:49:39PM
add the "-print" parameter before "-delete". (i.e. find $HOME/Library/Safari/Icons -type f -atime +30 -name "*.cache" -print -delete). This will tell you which files it's deleting. (If you put this in a cron job, though, you won't see the output.)

[ Reply to This | # ]
Cached 'favicons' in Safari can cause slowdowns
Authored by: sailorman on Mar 29, '04 07:18:05PM

I tried adding this routine to Macaroni as one of its jobs and Macaroni did not like it....When I ran it with the terminal I had the same result as macfeller, ie. Icon folder size stays the same. Surely I am overlooking something.



[ Reply to This | # ]
Cached 'favicons' in Safari can cause slowdowns
Authored by: macfeller on Mar 29, '04 09:08:32PM

Could this be a Jag vs. Panther thang? Different shells?



[ Reply to This | # ]
Cached 'favicons' in Safari can cause slowdowns
Authored by: Duaiwe on Mar 29, '04 09:08:39PM
the command works fine, and you don't need administrator access to use it. (It only access your own Library folder). The command Nugget listed does not generate any feedback if it works properly. It will just bring you right back to the prompt.

The command ces3001 listed will print out every file that it deletes. But, if it doesn't delete anything, it won't print anything out, and just drop you right back to the prompt.

The key here, is that the command only deletes icons that havn't been accessed in the last 30 days. So, if everything in that folder has been accessed in the last 30 days, the command won't delete anything, and the folder size will stay the same. If you just want it to delete everything, then drop the -atime +30 bit:

find $HOME/Library/Safari/Icons -type f -name "*.cache" -delete

---
To know recursion, you must first know recursion.

[ Reply to This | # ]

Cached 'favicons' in Safari can cause slowdowns
Authored by: bluehz on Mar 30, '04 08:02:41AM

Just doing a few tests - modified a cache file at $HOME/Library/Safari/Icons/15/15 to show a created/modified date of 12/25/2003. Then ran..

find $HOME/Library/Safari/Icons -type f -atime +30 -name "*.cache" -delete ... e.g.:

$HOME/Library/Safari/Icons/15/15/
-rw-r--r-- 1 XXXX XXXX 107 Dec 25 12:25 3107740148-3612648702.cache

It did not find or delete the file that was obviously over 30 days old. Apparently this find command will not recurse into dir, so the actual root "$HOME/Library/Safari/Icons/15" would have to show a modified/created date in the last 30 days.



[ Reply to This | # ]
Cached 'favicons' in Safari can cause slowdowns
Authored by: Duaiwe on Mar 30, '04 08:36:05AM

I believe that the "-atime" switch checks the <b>access</b> time of the file, and not the modification or creation times. (At least, it seems that way according to find's man pages).

So, since you accessed the file in order to change its created/modified dates, it was likely accessed in the last 30 days, and not deleted.

---
To know recursion, you must first know recursion.



[ Reply to This | # ]
Cached 'favicons' in Safari can cause slowdowns
Authored by: msk on Mar 30, '04 10:08:54AM

the "-delete" on find will not work if you access the GNU version of find, which happened to me because I have /sw/bin/find in my Unix path before /usr/bin/find, because I installed "findutils" from fink (and removed now). (-exec rm {} \; is a possible replacement)

Also, find always descends into directories. The problem is that a lot of these cache files are getting accessed more recently, at least on my machine I had only two icon cache files not accessed in the last day.

I put:

find /Users/*/Library/Safari/Icons -type f -name "*.cache" -delete

in /etc/daily.local, that way those pesty icons will get cleaned once a day--I'll move it to a different script (weekly or monthly) once I see that I got it right. You have to create that script, read the scripts in /etc/periodic to get more ideas.



[ Reply to This | # ]
Lock it down
Authored by: gatorparrots on Mar 29, '04 10:55:42PM
chflags uchg "$HOME"/Library/Safari/Icons
is just plain easier. Lock it and forget it. With broadband, the cache makes very little difference and just poses a great manageability problem.

[ Reply to This | # ]
Cached 'favicons' in Safari can cause slowdowns
Authored by: kitm on Mar 30, '04 01:04:45AM

Since I don't leave my Mac on all night is there any way to add this to Macaroni?



[ Reply to This | # ]
Cached 'favicons' in Safari can cause slowdowns
Authored by: Libwolf on Jun 04, '04 04:19:58AM
find $HOME/Library/Safari/Icons -type f -atime +30 -name "*.cache" -delete
I installed this in crontab and since then I haven't had *any* safari icons show up at all. I've deleted the icons folder in ~/library/safari/ but that didn't work. Anyone have any suggestions?

[ Reply to This | # ]
Cached 'favicons' in Safari can cause slowdowns
Authored by: jpbjpbjpbjpb on Mar 29, '04 12:43:13PM

FYI, I ran into a similar problem that turned out to be a bad History file. Clearing it from within Safari didn't help, but quitting Safari, deleting ~/Library/Safari/History.plist and restarting Safari fixed the problem.

jpb



[ Reply to This | # ]
Cached 'favicons' in Safari can cause slowdowns
Authored by: wookitus on Mar 29, '04 01:47:42PM

Thank you so much! This fixed my VERY slow copy of Safari. I kept switching to other browsers because it got so slow!



[ Reply to This | # ]
Cached 'favicons' in Safari can cause slowdowns
Authored by: KathyDab on Mar 29, '04 05:16:25PM

This has got to be the best hint. I just cleaned up my cache that has some 500 plus files. And here I was thinking I'm doing my due diligen housekeeping - NOT

Thanks



[ Reply to This | # ]
Also watch out for autofill
Authored by: SteamSHIFT on Mar 30, '04 08:24:51AM

I'm a web developer and have been doing loads of work recently with forms. Every time I've clicked in a box to start adding stuff into a form, Safari has beachballed for a few seconds - enough to be really annoying. The culprit - autofill; once I emptied the autofill cache for "Other Forms" it started running fine again. I guess when that file gets big, it takes a while to search it.

---
--
Andy Bennett
SteamSHIFT



[ Reply to This | # ]
Same here. Turning Autofill off removed annoying 10s of waiting time every few minutes
Authored by: jiga on Mar 30, '04 12:44:24PM

After 1 year of usage, Safari became slow as a glacier. Every few minutes, the beachball showed up for 10 seconds, making it extremely annoying and unresponsive. The "form values" file grew to only 270kB in this year, but somehow Safari always took 10 seconds to search trough it. So I had to turn this useful feature off, because it took wayyyyy to much time.

I think it's too bad for Apple that they invested the coding effort for that feature but stopped too soon, making it unusable after 1 year - the point where it would really start to becoming usable because so many things are already cached and ready to go :-(



[ Reply to This | # ]
Cached 'favicons' in Safari can cause slowdowns
Authored by: David Allen on Mar 31, '04 03:28:12PM

I tried this favicons hint last night and now Safari has trouble opening websites. I keep getting a window telling me the server doesn't exist. This happens 2 to 3 times before Safari finds the page and loads it.



[ Reply to This | # ]
Cached 'favicons' in Safari can cause slowdowns
Authored by: itunes66 on Jul 06, '06 09:11:17AM
To Remove All Icons in the Directory use this command (it will delete all sub folders to):
rm -r ~/Library/Safari/Icons/*

and if you want confirmation on every examination and removeal use
rm -ir ~/Library/Safari/Icons/*

[ Reply to This | # ]