8 Replies Latest reply: Nov 23, 2008 2:01 PM by lkrupp
Babaganoosh Level 1 Level 1 (0 points)
I've turned on the Develop menu and selected 'Disable Caches'. However, this option does not 'stick', as after a few subsequent minutes of surfing, the option will turn itself off and re-enable caches on its own. How can I stop Safari from doing that?

I have tried the old trick for disabling caches (i.e. deleting the cache folders and using the 'touch' command to create empty files with the same names as those folders), but this will cause Safari to crash when the 'Warn when visiting fraudulent websites' option is turned on. So that's out.

iMac Core 2 Duo, Mac OS X (10.5.5)
  • Mulder Level 6 Level 6 (8,980 points)
    You can it like this:

    1. Quit Safari if it's running.
    2. Go to ~/Library/Caches/Safari and delete all the sub-folders in that folder.
    3. Get Info on that …Safari folder and check the box that says "Locked".
    4. Close the window and restart Safari.

    Mulder
  • Babaganoosh Level 1 Level 1 (0 points)
    ^ That won't work, since Safari's "Warn when visiting fraudulent websites" depends on its ability to access the cache folder. If I mess with that, it will cause the crashing behavior I described earlier.

    Edit: I found it! I simply deleted the Cache.db file, 'touch'ed a new one, then locked the resulting empty file.

    Note that this is not in ~/Library/Caches/com.apple.Safari. That folder seems to always be empty - it's a 'dummy' folder. You've got to find the real cache folder, the one hidden away with a folder name that's ridiculously long and complicated.
  • Mulder Level 6 Level 6 (8,980 points)
    If I mess with that, it will cause the crashing behavior I described earlier.


    It shouldn't. Did you test it? What you'd be doing is removing all the sub-folders where cache files are stored and locking the folder so items can't be added to it and saved.

    Note that this is not in ~/Library/Caches/com.apple.Safari. That folder seems to always be empty - it's a 'dummy' folder.


    No, it's not a dummy folder, nor is it always empty. It fills up quite nicely on my machine and millions of others.

    Mulder
  • lkrupp Level 4 Level 4 (3,535 points)
    Mulder,

    Actually, with the arrival of Leopard, the cache scheme is completely different. Your signature indicates you are a Tiger guy and for you things are as they've always been. But Leopard's Safari cache is now located in /var/folders/IZ/(some really long gibberish)/-caches-. I think the long gibberish folder name may change from machine to machine for security reasons but I really don't know. Mail.app's cache is also in this folder. Leopard really is a cat of a different color.
  • ~Bee Level 7 Level 7 (31,160 points)
    lkrupp --
    Fascinating!
    Thanks so much for sharing that info.
    So, if a person could not get Safari to stay open long enough to clear the cache,
    what would be the path to empty the cache???
  • lkrupp Level 4 Level 4 (3,535 points)
    From the Finder type shift-command-G or Go->Go to folder...

    /var/folders/IZ is the path. Within the IZ folder you will see another folder with a very long, random character name. Open that folder and you will a folder named -Caches-. Within the -Caches- folder you find the folder com.apple.Safari. Inside the com.apple.Safari folder are the files Cache.db and SafeBrowsing.db. These are Safari's actual caches in Leopard. This is also the reason some people are having trouble with Safari 3.2. If they have disabled Safari's cache using the terminal or a utility like Onyx, Cocktail, or any of the other Safari utilities that disable the cache then Safari 3.2 can't access the SafeBrowsing.db and apparently crashes. This is also why turning off the fraudulent website preference causes some user's Safari to start working again. And of course, a whole lot of people were obsessed with speeding up Safari and took bad advice to disable the cache, then promptly forgot they did so. Then when Safari 3.2 blew up in their faces they had no clue. Combine that with all the third-party add-ons and, well, you get the picture.

    Trashing the Cache.db and the SafeBrowsing.db files may also be a good troubleshooting tool. But remember, we're talking Leopard only, not Tiger.
  • ~Bee Level 7 Level 7 (31,160 points)
    Thank you so much, l.
    I copied that one!
  • lkrupp Level 4 Level 4 (3,535 points)
    ~Bee wrote:
    Thank you so much, l.
    I copied that one!


    As you may already know the /var/ folder is an invisible folder at the root of your boot drive. You can only see this folder from the terminal or by using the Go to folder... in Finder. If you opened the -Caches- folder you also saw that most Apple applications now have their caches in this folder.