Change cache directory for Chrome (Windows, Linux, Mac)

Ever since I’ve been using my SSD in my MacBook Pro (the hard drive that was in it is still there, I just had to take the optical drive out and replace it with a caddy so that I can use my SSD and the HDD in the same laptop), I’ve been looking for ways to keep the overall life expectancy as high as possible. Once simple way of doing this is by moving the cache directory for your browser off of the SSD and somewhere else. This post will teach you how to do this for Chrome in Windows, Linux, and Mac OS X.

One major reason in doing this (for SSD users) is to keep from having thousands and thousands of reads/writes being done while you browse the Internet. If you’ve been browsing the web for an hour or two, or haven’t cleared out your cache in a long time, maybe you should check out all of the files that have been written to your cache directories.

Mac & Linux

First, I’ll start with Mac & Linux. There are a few ways of changing your cache directory for Chrome:

  1. Running Chrome through the command line with “–user-data-dir=”NEW_LOCATION”” – This is just a temporary solution, and Chrome will have to be run like this every time you want Chrome to use this new directory.
  2. Make a symbolic link – Think of these are shortcuts that are targeted towards another directory.

We’ll be talking about number 2. It’s very easy and straightforward.

  1. Open Terminal.
  2. Run “ln -s TARGET_DIRECTORY NAMEOFSYMLINK” – Replace  TARGET_DIRECTORY with where you’d like your new cache to be stored. Replace  NAMEOFSYMLINK with the name of the symlink file, which should be  Cache.
  3. There should be a symlink in your home directory. Move this file to where Chrome’s current cache directory is located. For Mac OS X, it’ll be in “~/Library/Caches/Google/Chrome/Default“. I’m not sure where it’s located in Linux, but you can find it if you browse around a little bit. You’ll also need to delete the “Cache” directory that’s already there.

So there you have it. You’ve successfully changed the location of Chrome’s cache in Mac OS X and/or Linux.

Windows

Doing this in Windows is basically the same thing. We’ll be using a freeware command-line based application called “Junction” to create symlinks for Windows to use. Since Windows 2000, Windows has supported symlinks but there weren’t any tools used to create them, so that’s where “Junction” comes into play.

  1. Download “Junction” here: http://technet.microsoft.com/en-us/sysinternals/bb896768.aspx
  2. Extract “junction.exe” to your desktop.
  3. Open Command Prompt.
  4. Run cd Desktop.
  5. Run junction OLD_DIRECTORY NEW_DIRECTORY. Refer to the below image on what directories you should put.

Junction in Command Prompt

Chrome's cache being populated in my new target directory

So there you [also] have it. You’ve just used a simple program called “Junction” to create a symlink in Windows.

Follow me on Twitter: http://twitter.com/gumballtech

You can leave a response, or trackback from your own site.
  • L_las

    Exe with spyware etc?!

  • http://gumballtech.com brian

    Huh?

  • http://gumballtech.com brian

    Huh?

  • Moscowhilton

    Have you actually tested this? Chrome just moves the symlink aside, ignores it, and recreates the original cache directory.

  • http://gumballtech.com brian

    Mine has been doing the same thing. Works fine in Windows and Linux. Not sure why the Mac version resets it.

  • cyring

    chromium/Default/Cache/ is a sub directory of hidden directory .cache

    so do

    ln -fs /home/LOGIN/tmp /home/LOGIN/.cache

    where /home/LOGIN/tmp is mounted as a tmpfs filesystem in /etc/fstab

  • cyring

    chromium/Default/Cache/ is a sub directory of hidden directory .cache

    so do

    ln -fs /home/LOGIN/tmp /home/LOGIN/.cache

    where /home/LOGIN/tmp is mounted as a tmpfs filesystem in /etc/fstab

  • tester

    does not work anymore

  • Marrano

    For Linux it is in ~/.cache/google-chrome/

    Nice Post!

  • Marrano

    For Linux it is in ~/.cache/google-chrome/

    Nice Post!

  • Marrano

    For Linux it is in ~/.cache/google-chrome/

    Nice Post!