Skip to content

Instantly share code, notes, and snippets.

Created August 10, 2016 10:13
Show Gist options
  • Save maciekish/66b6deaa7bc979d0a16c50784e16d697 to your computer and use it in GitHub Desktop.
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.
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/*
open /Applications/
Copy link

later: thanks!

Copy link

you da bomb

Copy link

Didn't work, still showing me old logs when I relaunch Xcode.

Copy link

Boom! Found this via Google. Great job

Copy link

neoneye commented May 11, 2018

Worked for me. I'm using Swift4.1 (Xcode9.3)

Copy link

worked for me XCode9.4. I had XCode10 beta installed, but it did not work. Then I installed XCode 9.4 which was working, then I removed Xcode10beta, after that the Xcode 9.4 did not work until I ran

Copy link

alanzeino commented Aug 21, 2018

If you're removing DerivedData and the ModuleCache xcodebuild -alltargets clean is probably redundant.

Optionally consider adding pkill -int, which we do between Xcode upgrades to minimize the potential for simulator flakiness.

Copy link

rudifa commented Aug 26, 2018

Worked for me with Xcode 9.4.1.
Also, I replaced the last line in script with

if [ $TARGET == "*.xcworkspace" ]; then
    if [ $TARGET == "*.xcodeproj" ]; then
if [ $TARGET != "" ]; then
    open -a "/Applications/" "$TARGET"
    echo *** Xcode workspace or project not found

Copy link

Very nice, fixed an issue I and others had after a react-native-firebase release
thank you!

Copy link

you are a GENIUS !! dammmmm

Copy link

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.

Copy link

Life saver!

Copy link

Great gist!

Copy link

MiklinMA commented Mar 6, 2024

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