Skip to content

Instantly share code, notes, and snippets.

@gtchakama
Last active March 17, 2026 23:46
Show Gist options
  • Select an option

  • Save gtchakama/b15ce05bd485a086a8a0526ffd7c3bff to your computer and use it in GitHub Desktop.

Select an option

Save gtchakama/b15ce05bd485a086a8a0526ffd7c3bff to your computer and use it in GitHub Desktop.
macOS Storage Cleanup Script
#!/bin/bash
# Storage Cleanup Script
echo "🧹 Starting storage cleanup..."
# 1. Homebrew Cleanup
if command -v brew &> /dev/null; then
echo "🍺 Cleaning up Homebrew..."
brew cleanup -s
rm -rf "$(brew --cache)"
else
echo "⚠️ Homebrew not found, skipping..."
fi
# 2. Clear App Caches (Safe to remove)
echo "πŸ“‚ Clearing application caches..."
rm -rf ~/Library/Caches/Google/*
rm -rf ~/Library/Caches/Homebrew/*
rm -rf ~/Library/Caches/com.spotify.client/*
rm -rf ~/Library/Caches/BraveSoftware/*
rm -rf ~/Library/Caches/CocoaPods/*
rm -rf ~/Library/Caches/typescript/*
rm -rf ~/Library/Caches/node-gyp/*
# 3. Clean up Downloads
echo "πŸ“₯ Removing disk images from Downloads..."
rm -f ~/Downloads/*.dmg
rm -f ~/Downloads/*.pkg
# 4. System Logs
echo "πŸ“ Cleaning user logs..."
rm -rf ~/Library/Logs/*
echo "βœ… Cleanup complete! 😌"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment