Clear Google Drive File Stream Cache under macOS on User Login – Delete/Empty the content_cache folder automatically

I’m in a hurry! TL;DR?

  1. Download and unzip this Automator script to your Home dir (or iCloud Drive)
  2. open System Preferences > Users & Groups
  3. select your user on the left
  4. switch to Login Items on the right
  5. click the “+” at the bottom of the list
  6. select the Clear Google File Stream Cache script you’ve just downloaded
  7. Done!

What’s the problem?

Google Drive File Stream is a compelling option among cloud storage services – as the name implies, it does not store all your files physically on your disk, but rather, it streams them. While technically this is somewhat true, there is a catch here: a local cache is built to speed things up (and save bandwidth on both ends).

Problem is, the cache size configuration is not behaving as it should: there is a KB article that aims to tell you how to configure the Google Drive File Stream cache policy, in reality it didn’t work me and neither did for a handful of other users. Depending on usage, the content_cache folder easily eats up anywhere between 40 to 110 gigabytes of storage.

What can we do about it?

There already are a number of threads about this problem, click here to check the one I’ve posted to as well – in the meantime, I’ve put together a small hack-ish solution to clear the cache on login which essentially means deleting the content_cache folder within the user’s Library/Application Support/Google/DriveFS using the default shell provided by macOS.

You can check the TL;DR above or follow along and do the steps yourself to achieve the same result.

We’re going to use a basic find command within a shell script that is run via an Apple Automator application every time the user logs in. Alternatively, one could also use plist files for launch demons at login.

Let’s get started!

Creating the Apple Automator script

  1. start the Automator app either via Launchpad, Spotlight or Finder > Applications
  2. once it has started, select Application and click Choose
  3. in the top-left corner click on Library (if it is not already visible
  4. select “Library” at the top of the tree list
  5. search for “Run Shell Script” and add it via double-clicking on it
  6. for Shell select /bin/sh
  7. put the following into the text field:
    find ~/Library/Application\ Support/Google/DriveFS -type d -exec test -e '{}'/content_cache \; -exec rm -rf {}/content_cache \;
  8. click on File > Save…
  9. set the File Format to Application
  10. save it to your Home folder or iCloud Drive with a descriptive name, like “Clear Google File Stream Cache

Adding the cache cleaning script to the Login Items

  1. open System Preferences > Users & Groups
  2. select your user on the left
  3. switch to the Login Items tab on the right
  4. click the “+” at the bottom of the list
  5. select the Clear Google File Stream Cache script you’ve just saved
  6. Done!

Now the Google Drive File Stream cache is cleared by removing the content_cache directory every time during the user’s login.

Thanks for reading! Please consider Buying me a Coffee or checking out Colibri!