Skip to content

Instantly share code, notes, and snippets.

@Aidurber
Last active September 29, 2022 13:14
Show Gist options
  • Star 14 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save Aidurber/7549d3f83b00052cee745a6c4dcf7b9d to your computer and use it in GitHub Desktop.
Save Aidurber/7549d3f83b00052cee745a6c4dcf7b9d to your computer and use it in GitHub Desktop.
A handy script to clean up a mac thanks to - Gant Laborde's article: https://medium.freecodecamp.org/how-to-free-up-space-on-your-developer-mac-f542f66ddfb
# Cleanup old node_modules
echo "Cleaning node_modules in projects older than 30 days"
find . -name "node_modules" -type d -mtime +30 | xargs rm -rf
echo "Done cleaning node_modules"
# Clean up homebrew
echo "Clean homebrew"
brew update && brew upgrade && brew cleanup
echo "Done cleaning homebrew"
# Clean up outdated gems
echo "Clean gems"
gem cleanup
echo "Done cleaning gems"
# Clean up pod caches
echo "Clean up pod caches"
rm -rf "${HOME}/Library/Caches/CocoaPods"
echo "Done cleaning pod caches"
# Delete old XCode simulators
echo "Delete old XCode simulators"
xcrun simctl delete unavailable
echo "Done deleting old XCode simulators"
# Clean up xcode junk
echo "Clean XCode junk"
rm -rf ~/Library/Developer/Xcode/Archives
rm -rf ~/Library/Developer/Xcode/DerivedData
rm -rf ~/Library/Developer/Xcode/iOS Device Logs/
echo "Done cleaning XCode junk"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment