Thomas Rosen - Blog

Possible Clutter on MacOS


Listen Later

Apps / FoldersSome folders/apps that clutter on macos.node\_modulesIf you develop javascript stuff these can clutter a huge portion of your system.
Use find . -type d -name node\_modules -prune 2>/dev/null to get the node\_modules folders in the current dictonary. -prune stops find from going into subfolders inside node\_modules.
Checking the whole system often was not helpful, as many electron apps also have a node\_modules folder that is needed for them to function..git repo foldersSometimes cleaning up a git repo is a good idea. Linus has some words about that here: https://gcc.gnu.org/legacy-ml/gcc/2007-12/msg00165.html
In short, run git repack -a -d --depth=250 --window=250. This apparently can take a long time, so run it over night.
Here is a loop, to apply that to all subfolders (if they are a git-repo): for d in \*/; do (cd "$d" && git rev-parse --is-inside-work-tree >/dev/null 2>&1 && echo "=== $d ===" && git repack -a -d --depth=250 --window=250); done.Apple Music Artwork cachingThe folder ~/Library/Containers/com.apple.AMPArtworkAgent was a few GB. This is apperently a process to cache artwork for apple music.Apple Voice MemosWhen everything is synced to iCloud, this can be a multi GB folder, you can savely delete:
\~/Library/Application Support/Group Containers/group.com.apple.VoiceMemos.sharedTo be continued…Terminal StuffTo get the folders in your current dictonary listed sorted by size, use du.
Here is a full command is use: du -h -d 1 -t 2M | sort -hr. This also only gets the folders over 2mb.
Use du -sh \* to get the size of all direct subfolders without sorting or restrictions.Find folders by using something like find . -type d -name "node\_modules" 2>/dev/null. (2>/dev/null makes it ignore all errors.)Use rm -R your\_folder\_path to delete whole dictonaries. PLEASE be careful!!! This deletes stuff without being able to bring it back.Articles about cleaning storage space on macosWhat is safe to delete?Something about DARWIN\_USER\_CACHE\_DIR: The missing gigabytes of disk space on my MacAbout cleaning git repos. Re: Git and GCC
...more
View all episodesView all episodes
Download on the App Store

Thomas Rosen - BlogBy Thomas Rosen