Introduction
One perfect day I noticed that my system disk is out of space although I did not expect it to happen so fast (7 years is not a long time, no-no).
Here is how you can check your disk as well:
But anyway, after googling and applying some tips and tricks I decided to share my way of mac disk cleanup.
Hadi gidelim (Let's go - turkish)
Plz apply at your own risk. It may harm your laptop, be sure you are not deleting crucial system or personal files.
1. Outdated node_modules
If you do not delete old projects which you git-cloned, npm-installed and ran on your computer - you may be surprised how much space to may take.
To find out open Finder and run search with such statement:
kind:Folders node_modules
After search finish, select all folders, right click with mouse and chose "Get [summary] info" to calculate total space:
And 4Gb - is not that small.
After that you can check each of them by right-clicking and selecting "Show in enclosing folder"
and delete if it is a project you don't plan to run anymore.
2. npm cache cleanup
If you do not clean npm cache - it may contain may outdated packages.
So just run
npm cache clean -f
Prior to this you can check how much space it takes. Open a terminal:
cd ~/.npm
du -h
(And this is a value after cleanup was done recently).
So cleaning npm cache from time to time is not a bad idea.
3. Old Docker related files
If you use Docker some old images may stay on a disk so better to get rid of them:
docker system prune -a
4. Docker.raw file
Docker for Mac stores containers and images in a single large file named Docker.raw.
To reduce its side after prun open Docker Desctop preferences and then under 'Resources'->'Advanced' setup Disk image size (my default was 64Gb!)
5. Terraform cache files.
If you use Terraform to rollout infrastructure (or at least passed some Terraform video course) do not forget to remove .terraform cache folder in each project. It is really big
6. Microsoft OneNote cache
If you use Microsoft OneNote on Mac - it keeps local backup (although it is stored already in a cloud).
We can a) turn backup off and b) remove it.
a) How to turn it off?
Open System Preferences
Choose TimeMachine on the panel. Uncheck the checkbox "Backup Automatically"
Well, actually you just turned off the whole Mac backup, so think twice.
b) Now let's remove the local OneNote backup
Finder -> Go -> Go to folder and enter: ~/Library/Containers
And then navigate to
/Users/oposhtaruk/Library/Containers/com.microsoft.onenote.mac/Data/Library/Application Support/Microsoft User Data/OneNote/15.0
and remove folder Backup.
7. Remove old Google Cache.
There are some old Google Cache files in a folder
/Users/oposhtaruk/Library/Application Support/Google/Chrome/Default.
Go there in a terminal
cd "/Users/oposhtaruk/Library/Application Support/Google/Chrome/Default"
And run du command to output the biggest folders there:
sudo du -h -d2 | grep G
Remove any folder that have Cache in their name (do this for your own risk, I did with no consequences)
8. Applications cache cleanup.
Check cache folders of old uninstalled programs (or even existing ones but with extra-large outdated cache) with such terminal commands:
cd ~/Library/Caches
sudo du -h -d2 | grep G
Delete the biggest folders or folders of applications that you uninstalled.
9 Edge Updater Files
Btw I don't why it makes so much space.
But here we are:
cd ~/Library/Application Support/Microsoft/EdgeUpdater/apps/
sudo du -h -d2 | grep G
I just deleted all subfolders in ./EdgeUpdater/apps/msedge-canary
And here we are! Some GB's of space are freed and we can continue wasting using it again.
This article is a part of my own learning process. If you found some wrong or partially wrong statement — feel free to correct me in comments.
Let’s keep in touch on Twitter!
Cheers!