Skip to content

Instantly share code, notes, and snippets.

@david30907d
Last active January 24, 2026 06:37
Show Gist options
  • Select an option

  • Save david30907d/d15546e89dd0a66a78db1bda2bf93328 to your computer and use it in GitHub Desktop.

Select an option

Save david30907d/d15546e89dd0a66a78db1bda2bf93328 to your computer and use it in GitHub Desktop.
#!/bin/bash

echo "=== Cleanup started: $(date) ==="

brew cleanup -s      
rm -rf ~/Library/Caches/Homebrew
# Node caches
npm cache clean --force 2>/dev/null
yarn cache clean 2>/dev/null
pnpm store prune 2>/dev/null
rm -rf ~/.cache/*
# iOS 模擬器
rm -rf ~/Library/Developer/CoreSimulator/Caches
rm -rf ~/Library/Developer/CoreSimulator/Devices

# DerivedData
rm -rf ~/Library/Developer/Xcode/DerivedData
rm -rf ~/Library/Developer/Xcode/Archives
echo "=== Cleanup finished: $(date) ==="
@david30907d
Copy link
Author

cronjob:

#!/bin/bash

echo "🧹 Cleaning mobile app build & local caches..."

# 專案內部快取與編譯產物
find . -type d -name "build" -exec rm -rf {} +
rm -rf ios/build android/build ios/Pods node_modules

# Flutter 清理(如有)
if command -v flutter &> /dev/null; then
  flutter clean
  flutter pub cache clean
fi

# 全域工具快取
rm -rf ~/.npm/_cacache
rm -rf ~/.gradle/caches
rm -rf ~/.cache/yarn/v6
yarn cache clean

echo "✅ Done!"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment