Skip to content

Instantly share code, notes, and snippets.

@jongan69
Created July 25, 2025 19:50
Show Gist options
  • Save jongan69/e24d90ab5506feaf9a7b945e28aa0da6 to your computer and use it in GitHub Desktop.
Save jongan69/e24d90ab5506feaf9a7b945e28aa0da6 to your computer and use it in GitHub Desktop.
clean up on mac
#!/bin/bash
echo "🔧 Starting Mac dev cleanup..."
# 1. Clear User & System Cache
echo "🧹 Clearing system and user caches..."
sudo rm -rf ~/Library/Caches/* /Library/Caches/*
# 2. Xcode Derived Data
echo "🧹 Removing Xcode Derived Data..."
rm -rf ~/Library/Developer/Xcode/DerivedData/*
# 3. iOS Simulators
echo "🧹 Deleting unavailable iOS Simulators..."
xcrun simctl delete unavailable
# 4. CoreSimulator device junk
echo "🧹 Removing CoreSimulator devices..."
rm -rf ~/Library/Developer/CoreSimulator/Devices/*
# 5. System logs
echo "🧹 Clearing system logs..."
sudo rm -rf /private/var/log/*
# 6. Docker cleanup
echo "🐳 Cleaning Docker..."
docker system prune -af --volumes
# 7. NPM/Yarn cache
echo "📦 Cleaning NPM/Yarn cache..."
npm cache clean --force
yarn cache clean
# 8. Homebrew cache
echo "🍺 Cleaning Homebrew cache..."
brew cleanup -s
rm -rf "$(brew --cache)"
# 9. Trash
echo "🗑️ Emptying Trash..."
sudo rm -rf ~/.Trash/*
echo "✅ Done! Restart recommended to flush memory."
@jongan69
Copy link
Author

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