Created
August 10, 2016 10:13
-
-
Save maciekish/66b6deaa7bc979d0a16c50784e16d697 to your computer and use it in GitHub Desktop.
Reset Xcode. Clean, clear module cache, Derived Data and Xcode Caches. You can thank me later.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
killall Xcode | |
xcrun -k | |
xcodebuild -alltargets clean | |
rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang/ModuleCache" | |
rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang.$(whoami)/ModuleCache" | |
rm -rf ~/Library/Developer/Xcode/DerivedData/* | |
rm -rf ~/Library/Caches/com.apple.dt.Xcode/* | |
open /Applications/Xcode.app |
Worked for me with Xcode 9.4.1.
Also, I replaced the last line in script with
TARGET=(*.xcworkspace)
if [ $TARGET == "*.xcworkspace" ]; then
TARGET=(*.xcodeproj)
if [ $TARGET == "*.xcodeproj" ]; then
TARGET=""
fi
fi
if [ $TARGET != "" ]; then
open -a "/Applications/Xcode.app" "$TARGET"
else
echo *** Xcode workspace or project not found
fi
Very nice, fixed an issue I and others had after a react-native-firebase release
invertase/react-native-firebase#2269
thank you!
I created a shell script (tested on bash or zsh) to do this inside any Xcode workspace or project folder.
Check its gist's here.
Life saver!
Great gist!
Please welcome my Apple script which works just from spotlight (⌘+Space)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you're removing DerivedData and the ModuleCache
xcodebuild -alltargets clean
is probably redundant.Optionally consider adding
pkill -int com.apple.CoreSimulator.CoreSimulatorService
, which we do between Xcode upgrades to minimize the potential for simulator flakiness.