Paul Calnan's Blog
Published May 13, 2020

Has Xcode stopped working for you? Builds acting funny? Autocomplete stopped working? You've quit and restarted it, cleaned the build folder, and it's still broken?

Try running this.

#!/usr/bin/env bash

set -euo pipefail

echo "Exiting Xcode"
osascript -e 'quit app "Xcode"'

echo "Deleting DerivedData"
rm -rf ~/Library/Developer/Xcode/DerivedData/*

echo "Deleting llvm module cache"
rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang/ModuleCache"

echo "Relaunching Xcode"
open -a Xcode