How to clear Google Drive cache
TL;DR: run the command in your Terminal to remove your Drive File Stream cache:
rm -rf ~/Library/Application\ Support/Google/DriveFS/[0-9]*
WARNING: If files are pending upload to Drive, deleting the cache may cause the files to be lost (see comment).
Background
I installed the Google Drive desktop app in order to sync files between my computer and the cloud.
I found that you could right-click a file, hover over Drive File Stream
, and select an option:
Available offline
Online only
(default)
But even when Online only
is selected, large files still persist on my computer.
Clear cache directory
To remove all files from your computer cache, you can delete the Drive File Stream cache.
You can find your DriveFS cache path by going to Drive File Stream
> Settings
(gear icon) > Preferences...
> Local cached files directory
.
By default, the cache directory should be ~/Library/Application Support/Google/DriveFS
.
To delete the DriveFS cache directory using Terminal:
rm -rf ~/Library/Application\ Support/Google/DriveFS/
WARNING: If files are pending upload to Drive, deleting the cache may cause the files to be lost (see comment).
The side-effect of this is that it also deletes your credentials so you’ll need to login again.
Clear cache content directory
To clear cache without deleting credentials, you can delete just the cache content directory:
rm -rf ~/Library/Application\ Support/Google/DriveFS/[0-9]*
WARNING: If files are pending upload to Drive, deleting the cache may cause the files to be lost (see comment).
What the command above is doing is deleting the numeric directory from DriveFS:
$ cd ~/Library/Application\ Support/Google/DriveFS/
$ du -sh *224M 114104707028901901726
4.0K Crashpad
4.7M Logs
20M Resources
12K account_db_sqlite.db
512K cef_cache
4.0K pid.txt
4.0K signin$ rm -rf [0-9]*
$ du -sh *4.0K Crashpad
4.7M Logs
20M Resources
12K account_db_sqlite.db
512K cef_cache
4.0K pid.txt
4.0K signin
Note: The numeric folder name may change from machine to machine.
After deleting this directory, cached files can no longer be opened. In order to open the Drive File Stream files again, you’ll need to quit and restart the desktop app and sync the files.
Resources
See Uninstall Drive File Stream > Step 3: Clear files cached on your computer.