If you're like me, one day you got the dreaded message, "Your Mac is running low on disk space." The surprising thing is that I don't do anything other than develop on my Mac, so this was unexpected.
I've deleted node_modules worth 3 gigs once, so it's always a good idea to do this periodically if you deal with many repos.
But this time, even after deleting all the node_modules, the disk was still low, so I decided to dig deeper. In Windows, there's an interesting tool called WinDirStat that visualizes how your storage is distributed, giving you a clear-cut idea of what's taking up space. I haven't found an open-source WinDirStat alternative for Mac yet, so I turned to the good old terminal.
This command displays all the files and folders larger than 1 GB. I'd do this recursively through each large folder to determine which files are taking up the most space.
Most of the large files were under ~/Library, and I noticed I had a huge cache folder. Upon inspecting it, I realized that the Yarn cache was taking up almost 25 GB of space! Similarly, the Cypress folder was taking over 5 GB.