Skip to content

Instantly share code, notes, and snippets.

@astrokin
Created January 3, 2022 18:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save astrokin/b1f56ba9316def585372465084af3211 to your computer and use it in GitHub Desktop.
Save astrokin/b1f56ba9316def585372465084af3211 to your computer and use it in GitHub Desktop.
iOS developer clear disk usage cache
#!/bin/bash
killall Xcode
echo 'Xcode process killed'
xcrun -k
echo 'Remove the cache. Causes all values to be re-cached'
xcodebuild -alltargets clean
echo 'clean all targets'
rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang/ModuleCache"
echo 'ModuleCache removed'
rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang.$(whoami)/ModuleCache"
echo 'User ModuleCache removed'
rm -rf ~/Library/Developer/Xcode/DerivedData/*
echo 'DerrivedData removed'
rm -rf ~/Library/Caches/com.apple.dt.Xcode/*
echo 'Xcode Caches removed'
defaults delete com.apple.dt.Xcode
echo 'Defaults removed'
for file in `ls ~/Library/Preferences/ | grep Xcode`; do rm "/Users/$(whoami)/Library/Preferences/${file}"; done
echo 'Preferences removed'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment