Skip to content

Instantly share code, notes, and snippets.

@umutbasal
Created December 27, 2025 14:14
Show Gist options
  • Select an option

  • Save umutbasal/631cc84c0240c1f05db8874641140d9e to your computer and use it in GitHub Desktop.

Select an option

Save umutbasal/631cc84c0240c1f05db8874641140d9e to your computer and use it in GitHub Desktop.
#!/bin/bash
set -e
DIRS=(
# npm / node
~/.tnpm/_cacache
~/.tnpm/_logs
~/.yarn/cache
~/.bun/install/cache
~/Library/pnpm/store
# python
~/.pyenv/cache
~/.cache/poetry
~/.cache/uv
~/.cache/ruff
~/.cache/mypy
~/.pytest_cache
~/.jupyter/runtime
~/.cache/huggingface
~/.cache/torch
~/.cache/tensorflow
~/.conda/pkgs
~/anaconda3/pkgs
~/.cache/wandb
# go
~/.cache/go-build
~/go/pkg/mod
# rust
~/.cargo/registry/cache
~/.cargo/git
~/.rustup/downloads
# docker
~/.docker/buildx/cache
# nix
/nix/var/nix/gcroots
/nix/store
# cloud / containers
~/.kube/cache
~/.local/share/containers/storage/tmp
~/.aws/cli/cache
~/.config/gcloud/logs
~/.azure/logs
# frontend
~/.cache/typescript
~/.cache/electron
~/.cache/node-gyp
~/.node-gyp
~/.turbo/cache
~/.vite/cache
~/.cache/vite
~/.cache/webpack
~/.parcel-cache
~/.cache/eslint
~/.cache/prettier
# mobile / xcode / android
~/Library/Developer/Xcode/iOS\ DeviceSupport
~/Library/Developer/CoreSimulator
~/Library/Caches/Google/AndroidStudio*
~/Library/Caches/CocoaPods
~/.cache/flutter
~/.android/build-cache
~/.android/cache
~/Library/Developer/Xcode/UserData/IB\ Support
~/.cache/swift-package-manager
# jvm
~/.gradle/caches
~/.gradle/daemon
~/.sbt
~/.ivy2/cache
# other languages
~/.bundle/cache
~/.composer/cache
~/.nuget/packages
~/.pub-cache
~/.cache/bazel
~/.cache/zig
~/Library/Caches/deno
# ci / cd
~/.cache/terraform
~/.grafana/cache
~/.prometheus/data/wal
~/.cache/gitlab-runner
~/.github/cache
~/.circleci/cache
~/.sonar
# databases
~/Library/Caches/com.sequel-ace.sequel-ace
~/Library/Caches/com.eggerapps.Sequel-Pro
~/Library/Caches/redis-desktop-manager
~/Library/Caches/com.navicat.*
~/Library/Caches/com.dbeaver.*
~/Library/Caches/com.redis.RedisInsight
# api / network tools
~/Library/Caches/com.postmanlabs.mac
~/Library/Caches/com.konghq.insomnia
~/Library/Caches/com.tinyapp.TablePlus
~/Library/Caches/com.getpaw.Paw
~/Library/Caches/com.charlesproxy.charles
~/Library/Caches/com.proxyman.NSProxy
# misc
~/Library/Caches/com.unity3d.*
~/Library/Caches/com.mongodb.compass
~/Library/Caches/com.figma.Desktop
~/Library/Caches/com.github.GitHubDesktop
~/Library/Caches/SentryCrash
~/Library/Caches/KSCrash
~/Library/Caches/com.crashlytics.data
# shell / vcs
~/.oh-my-zsh/cache
~/.cache/pre-commit
# network utils
~/.cache/curl
~/.cache/wget
~/Library/Caches/curl
~/Library/Caches/wget
# homebrew
~/Library/Caches/Homebrew
)
echo "Calculating disk usage..."
echo
printf "%-10s %-19s %s\n" "SIZE" "MODIFIED" "PATH"
printf "%-10s %-19s %s\n" "----------" "-------------------" "----"
tmpfile="$(mktemp -t clean-sh.XXXXXX)"
trap 'rm -f "$tmpfile"' EXIT
for dir in "${DIRS[@]}"; do
if [ -d "$dir" ]; then
size_kb="$(du -sk "$dir" 2>/dev/null | awk '{print $1}')"
size_h="$(du -sh "$dir" 2>/dev/null | awk '{print $1}')"
modified="$(stat -f "%Sm" -t "%Y-%m-%d %H:%M:%S" "$dir" 2>/dev/null || true)"
printf "%s\t%s\t%s\t%s\n" "$size_kb" "$size_h" "$modified" "$dir" >>"$tmpfile"
fi
done
sort -t $'\t' -k1,1nr "$tmpfile" | awk -F'\t' '{printf "%-10s %-19s %s\n", $2, $3, $4}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment