How to recover 50 GB or even more by deleting Sketch caches files
I use Sketch everyday now, I never suspected Sketch to be the main issue of the limited free space in my hard drive. I blamed it on Photoshop but it wasn’t the main problem. But after reading the article
by @thomasdegry, I knew that it was Sketch. Here’s how I fixed the problem.
First, figure out how much space you’re loosing
Simply open the Terminal and paste this line of code:
sudo du -sh /.DocumentRevisions-V100
Here we got 64Go hiding in the .DocumentRevisions-V100's folder.
@thomasdegry give us the solution to prevent Sketch from saving useless copy again, but we still have to figure it out how to delete all this wasted space.
Find the hidden folder
For that, you need to make the system files appear.
I. Open Terminal which is found in Finder > Applications > Utilities
II. In Terminal, paste the following line:
defaults write com.apple.finder AppleShowAllFiles YES
III. Press return
IV. Hold the ‘Option/alt’ key, then right click on the Finder icon in the dock and click on Relaunch.
Now you’ll see the folder we talked about before.
To enter in that folder, you’ll need the permission. For that, click right on this (.DocumentRevisions-V100) and click on “Get Info”. You will see a bunch of infos, but what we are interested in is the “Sharing & Permissions” section at the bottom. Click on the key lock and enter your password. Then change the allowance of Everyone to “Write and Read”. Don’t forget to put back all the settings after we finish.
Now you have access to this folder, try to find the folder named “.cs” and repeat the same operation for this folder. You’ll now see ChunkStorage, we’re almost done don’t worry. Repeat the same operation for this folder.
Try to open a folder with the same process, you’ll now see all the copies of sketch files.
At this moment, I just erased all the files in this folder. I let the ChunkStorage folder in case. Do not delete all the .DocumentRevision files, it will lead you to bugs and performance issues.
Now, you can follow the fix of @thomasdegry to stop sketch saving caches files and type this on your Terminal:
defaults write -app ‘sketch’ ApplePersistence -bool no
Be careful with the quote, simply re-type by a simple quote in the Terminal.
I know there is a lot of way to fix this issue, but it’s the simplest way I found to do it, and so far, I haven’t had any issues with this.
Feel free to let comments and thoughts about this. And for those who are worried about this. Sketch is going to add a fix for the future release. But you still need to delete those files..
Cheers and have a good day!
Thanks again to @NicolasFallourd and @AntoinePlu for the screenshots.
Update 13th July 2017:
A tool does the work for you now :) Take a look at https://yo-op.github.io/sketchcachecleaner/