Firefox cache sanity

Tuesday, 8 Feb 2005

Thanks to the Secrets of Firefox 1.0 article, I finally fixed my greatest annoyance with Firefox: the disk cache location. Unlike a good Unix citizen, it doesn’t put the cache files somewhere in /tmp but rather bloats your profile with those. That forces extra care when making home directory backups or when keeping your home in a version control system – particularly if you are like me and like to have a huge disk cache.

The way to fix it is to set the browser.cache.disk.parent_directory preference to something sane. Now my user.js contains the following line:

user_pref("browser.cache.disk.parent_directory", "/tmp/browsercache");

After a browser restart, cache files will now be written to /tmp/browsercache/Cache. You will then have to remove the old cache directories from your profile manually, and can finally enjoy a clean home directory. Hooray!