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

Completely eliminate the browser cache in Safari Web Browsers
After growing weary of constantly trying to reload images in Safari after making web page updates, I tried the following, and seem to have successfully disabled the caching of web pages in Safari:
  1. Delete the Safari cache folder. This should be in ~/Library/Caches/Safari/.
  2. Create an empty text document and save it as 'Safari' (no extension) and place in ~/Library/Caches/. I think just about any type of Document would work for this, just make sure the name of the file matches the name of the old folder, this way, a new folder can't be created by Safari when one is needed
That's it. I haven't seen any negative results so far!

[robg adds: In the terminal, you can create this file quickly and easily by typing:
touch ~/Library/Caches/Safari
I tested it a bit this morning, and it does indeed seem to work fine and prevent the caching of pages.]
    •    
  • Currently 3.14 / 5
  You rated: 2 / 5 (7 votes cast)
 
[57,549 views]  

Completely eliminate the browser cache in Safari | 16 comments | Create New Account
Click here to return to the 'Completely eliminate the browser cache in Safari' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
The Unix way...
Authored by: mholve on Feb 20, '03 11:13:31AM

Why not do it the Unix way? ANY file that you don't want to grow, simply symlink it to the ol' bitbucket. Any data sent to the file will just vanish into the ether.

ln -s /dev/null /path/to/cachefile


---
--
Everything Mac - http://everythingmac.org



[ Reply to This | # ]
The Unix way...
Authored by: ppatoray on Feb 20, '03 05:50:37PM

I knew that there would be a better way to do this, but I am still getting used to using UNIX, and am learning things as the need or occasion arises. Thanks for the tip!

Patrick



[ Reply to This | # ]
The Unix way...
Authored by: artur9 on Feb 20, '03 09:37:28PM

Well, unfortunately, the Safari cache is not a single file. It's a directory of directories etc, etc, etc. So, it's not a growing file that you can just point at the bitbucker.

In other news, if you "Empty Cache..." Safari will delete this file and you'll have to make it over again.



[ Reply to This | # ]
The Unix way...
Authored by: xtchall on Jan 07, '06 11:39:28PM

me thinks you mean.. ln -s /dev/null ~/Library/Caches/Safari

maybe try this.. rm -fPr ~/Library/Caches/Safari;ln -s /dev/null ~/Library/Caches/Safari



[ Reply to This | # ]
Move Cache Location?
Authored by: jasonxz on Feb 20, '03 05:08:21PM

Using IE, I can select which disk or folder to place my web cache in, but I can't seem to figure out how to do that with Safari. Any ideas?



[ Reply to This | # ]
Move Cache Location?
Authored by: asterizk on Feb 20, '03 05:16:07PM

Hi jasonxz,

I think Safari's still a "work-in-progress" in that regard (I'm guessing the
option will probably appear in a future release).

krishen



[ Reply to This | # ]
RE: Move Cache Location?
Authored by: glowurm on Feb 20, '03 07:51:15PM

If you take a look to the above comment, titled "The Unix way..." I think it applies to your question as well. However, you would change the first path listed to the new location you wanted the cache file to reside in. So, rather than:

ln -s /dev/null /path/to/cachefile

you would have:

ln -s /newpath/for/cachefile /currentpath/to/cachefile

This would create a symbolic link in the current directory to the new directory. Make sure to note the use of spaces, and hopefully I haven't forgotten anything.



[ Reply to This | # ]
RE: Move Cache Location?
Authored by: jasonxz on Feb 20, '03 11:59:59PM

If I trash the old Safari cache folder after creating the symbolic link to a new path, will that cause problems?



[ Reply to This | # ]
Completely eliminate the browser cache in Safari
Authored by: Cantus on Feb 21, '03 03:37:16AM
This worked for me. It will delete the Safari folder and create an empty file with the name Safari in the same directory.

Paste the following in the Terminal window:

rm -rf ~/Library/Caches/Safari ; echo > ~/Library/Caches/Safari

[ Reply to This | # ]

Completely eliminate the browser cache in Safari
Authored by: fredhetz on Apr 09, '04 01:48:10PM

So far, this has worked like a charm for me. Thanks!



[ Reply to This | # ]
Completely eliminate the browser cache in Safari
Authored by: toontra on Feb 21, '03 03:56:07AM

The latest version of Safari Enhancer allows you to (amongst many other usefull things) toggle cache disabling on and off.



[ Reply to This | # ]
Completely eliminate the browser cache in Safari
Authored by: Maran on Sep 06, '03 10:38:43AM

This option, although selected for me in Enhancer, has never actually made a difference. This cache problem is driving back to Camino.

I have tried other things here without much success. It's unfortunate.



[ Reply to This | # ]
I tried this hint, and it did not work for me.
Authored by: jonathanmcd on Feb 21, '03 04:37:16PM

I created the empty text file, and Safari seemed to have no qualms creating a new folder, with the exact same name as the text file, right where the old one had been.

So, undaunted, I tried to fool Safari in a different manner... I manually emptied the contents of the cache folder, then hit [command] - i, and under the 'Ownership & Permissions' tab of the get info window, simply changed the folder permissions to read only. Now, Safari can't write to the folder, and I can easily confirm that my trick is still working by peeking inside the folder to make sure it's empty.

Voila!



[ Reply to This | # ]
Completely eliminate the browser cache in Safari
Authored by: aranor on Mar 02, '03 04:44:15PM

If you have the Debug menu available, select Show Caches Window. There's a checkbox to disable WebCore caches. This should work for you guys. I haven't tested it myself, but I'd assume it works just fine.



[ Reply to This | # ]
Completely eliminate the browser cache in Safari
Authored by: playdrums on Sep 16, '03 02:09:19PM

accept that it doesn't stick through Quit and re-launch.



[ Reply to This | # ]
Completely eliminate the browser cache in Safari
Authored by: AmsterQ on Feb 20, '06 10:52:01PM

This solution will prevent you form uploading to php script (and probably other occasions).
You will get the following error:
[code]
Safari can't open the page.
Safari can't open the page "http://cotillard.net/image-editor/upload.php?action=upload". The error was: "POSIX error: Invalid argument" (NSPOSIXErrorDomain:22) Please choose Report Bug to Apple from the Safari menu, note the error number, and describe what you did before you saw this message.
[/code]



[ Reply to This | # ]