What is SourceKitService, and why is it using so much CPU?
Quick answer
SourceKitService is part of Xcode's Swift toolchain (it lives in sourcekitd.framework). It powers code completion, syntax highlighting, quick help and indexing for Swift. It's busiest right after you open a project, change branches or update Xcode, while it re-indexes.
Why it gets busy
- Indexing after opening a big project, switching branches or resolving packages.
- Complex expressions (long chains of literals or operators) that are slow to type-check.
- A stale or corrupted index that keeps being rebuilt.
Usual fixes, in order
- Let indexing finish (watch the progress in Xcode's toolbar).
- Close projects and workspaces you aren't using.
- Quit Xcode and delete that project's folder in DerivedData (or just its
Index.noindex), then reopen. - Restart your Mac if it keeps restarting after a crash.
Questions
Is SourceKitService a virus?
No. It ships inside Xcode's toolchain.
Can I disable it?
Not without losing code completion and highlighting for Swift in Xcode.