Sketch can unknowingly take way too much hard drive space, here’s how to fix it.

Philippe HONG wrote an article, which he got from Thomas Degry, about an issue with Sketch taking a lot of storage space on their hard drive and how they solved the problem. What first look like a daunting task from reading these articles turned out to be a very simple way for me to personally clear over 80 GB of wasted space from my hard drive. What worried me most about this process was that I did not want to affect any system files by accident, and not understand how to revert any issues I may have caused, but by the end of the process I realised how simple, and safe it really was. I highly recommend giving this a go if you use sketch on a daily basis, and most importantly you have a version control system in place like InvisionSync, or dropbox.

What causes this?

Apple introduced a version control system in OSx lion which works with certain programs to save a copy of each file into a hidden folder calledDocumentRevisions-V100. Having this version control system in place allows you to revert to previous versions of a document, which can be a life saver in the right circumstances. Since I have a version control system in place already (InvisionSync) I decided that I can use the extra 80 GB of hard drive space more efficiently.

How to fix this

First off, let’s check how much storage space is being taken up by Apples version control system. Open up a terminal window and paste the following command and press enter.

sudo du -sh /.DocumentRevisions-V100

You’ll be prompted to enter your password, and although it looks like it is not typing it actually is, simply type your password and press enter and you should see something like the following.

You can see that I have 17 GB inside my document revisions folder, but before completing this process this folder was just over 100 GB. If you don’t have a substantial amount of space being taken by this folder then it may be best to leave it be, but that’s up to you.

The next step is to access the documents revisions folder through finder, which will require you to paste a command into terminal again;

defaults write com.apple.finder AppleShowAllFiles YES

After you’ve pasted this command in, tap enter. Now you simply need to hold down the option / alt key, right click the finder icon in your dock, and click ‘restart’. Once finder restarts you will be able to see your hidden folders. Repeat this process with ‘NO’ in place of ‘YES’ when you’ve finished to hide these hidden folders again. You should now be able to see hidden folders, and if you navigate to your HDD, you’ll see this;

You’ll notice that some of these folders are locked, so to get access you will need to right click, and navigate to “Sharing & Permissions” where you can click the little lock icon, enter your password, and change the permissions for everyone to “Write and Read”. It’s important that you revert these changes after completing this entire process.

Once you’ve changed the permissions, you will see more folders appearing, until you navigate all the way through to “ChunkStorage” as you can see above in the screenshot. When you arrive at ChuckStorage, you can see inside there will be numbered folders, which each have multiple files inside of them. It’s these files inside of the numbered folders that you can delete.

Once you have cleaned out your ChunkStorage folder, reverse the process of changing the permissions for all of the folders you just navigated through. Be careful to not delete anything other than what is inside the ChunkStorage folder and you will not run into any problems. After reverting the permissions on all of your folders, you can run the terminal command from earlier to hide the folders;

defaults write com.apple.finder AppleShowAllFiles NO

Afterwards you should relaunch finder again, and this will have now taken effect. The next part is something that not everyone may find useful, but I am sure a lot of people will.

To stop Apples native version control system from creating these backup Sketch cache files in the future, you can run a very simple command line in the terminal window, but before deciding to do this, you should be sure that you have an alternative version control system in place ( personally I use invisionSync ) which will ensure you don’t have a catastrophe on your hands down the track. If you DO have an alternative, then simply copy, paste and press enter with the following line;

defaults write -app ‘sketch’ ApplePersistence -bool no

You won’t see a ‘success’ message, but rest assured that this will have taken effect, and you can enjoy some extra hard drive space for the future.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.