Skip to content

Instantly share code, notes, and snippets.

Forked from maciekish/
Last active Feb 28, 2018
What would you like to do?
Reset Xcode. Clean, clear module cache, Derived Data and Xcode Caches
# curl -O && bash ./ ; rm ./
if [[ $(whoami) != jenkins ]]; then
echo "Run as jenkins"
exit 1
echo "--- cleaning Xcode ---"
echo "1. Kill Xcode"
killall Xcode
echo "2. Run xcodebuild clean"
xcrun -k
xcodebuild -alltargets clean
echo "3. Clean DARWIN_USER_CACHE_DIR ModuleCache"
rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang/ModuleCache"
rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang.$(whoami)/ModuleCache"
echo "4. Clean DARWIN_USER_CACHE_DIR Xcode stuff"
rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/"
rm -rf "$(getconf DARWIN_USER_CACHE_DIR)"/*
echo "5. Clean \$HOME Library data"
rm -rf ~/Library/Developer/Xcode/DerivedData/*
rm -rf ~/Library/Caches/*
echo "6. Reopen Xcode"
open /Applications/
echo "--- Done cleaning Xcode ---"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment