Have you ever run into that insanely irritating SourceKitService Crash Bug in Xcode? You know the one where a splash flashes like a strobo on the screen for every character typed? Especially if you’re coding and writing tests in Swift?
Turns out there is a work-around, waiting for a proper fix from Apple. To do so you need to quit Xcode, remove the ModuleCache directory under ‘~/Library/Developer/Xcode/DerivedData/’, and relaunch Xcode. Doing so is rather efficient and my Xcode has been up an running for up to a day(!) without a need for a ModuleCache wipe. However sometimes you need to pet Xcode a little extra, and therefor I recommend putting it in a shell script, alias or like me in a Fish Shell function. Open your config.fish file in your editor of choice:
1 |
mate ~/.config/fish/config.fish |
…and add the following function:
1 2 3 |
function wipe_xcode sudo rm -r ~/Library/Developer/Xcode/DerivedData/ModuleCache/ end |
Nice! Now you can just quit Xcode whenever the shit hits the fan and execute the wipe_xcode command. With code completion and all. Me like!