Fish Shell Function for Xcode SourceKitService Crash Bug

Fish Shell Function for Xcode SourceKitService Crash Bug

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?

SourceKitService Crashed

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 file in your editor of choice:

…and add the following function:

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!

Leave a Reply

Your email address will not be published. Required fields are marked *