A command-line tool that generates SCIP (Source Code Intelligence Protocol) indexes from Xcode's DerivedData for Swift projects. SCIP indexes enable powerful code navigation, search, and intelligence features in editors and code analysis tools.
- Index Generation: Extracts symbols, occurrences, and relationships from Xcode's index store
- Incremental Indexing: Only re-indexes changed files using git state tracking
- Branch-Aware Caching: Maintains separate index caches per git branch for fast branch switching
- Multiple Output Formats: Supports SQLite (
.db) and JSON (.json) output formats - Performance Optimized: Uses SQLite for efficient storage and fast queries on large codebases
- Status Tracking: Check index state and see pending changes
- macOS 13.0 or later
- Swift 5.9 or later
- Xcode with a built project (DerivedData must exist)
- Git repository (for incremental and branch-aware features)
git clone <repository-url>
cd SwiftSCIPIndex
swift build -c releaseThe executable will be available at .build/release/swift-scip-indexer.
After building, you can install it system-wide:
swift build -c release
cp .build/release/swift-scip-indexer /usr/local/bin/Generate a full SCIP index for your Swift project:
swift-scip-indexer index \
--derived-data ~/Library/Developer/Xcode/DerivedData \
--project-root /path/to/your/project \
--output /path/to/output.scip.dbNote: The default DerivedData location is ~/Library/Developer/Xcode/DerivedData. You can find your project's specific DerivedData path in Xcode's preferences under Locations → Derived Data.
- Open Xcode
- Go to Xcode → Settings → Locations
- Check the Derived Data path
- Look for a folder matching your project name (e.g.,
YourProject-xxxxx)
Only index files that have changed since the last run:
swift-scip-indexer index \
--derived-data ~/Library/Developer/Xcode/DerivedData \
--project-root /path/to/your/project \
--output /path/to/output.scip.db \
--incrementalIncremental mode uses git to track which files have changed, significantly speeding up indexing for large projects.
View the current index state and see what files need to be re-indexed:
swift-scip-indexer status \
--project-root /path/to/your/projectFor detailed file listings:
swift-scip-indexer status \
--project-root /path/to/your/project \
--verboseForce a complete re-index, ignoring any cached state:
swift-scip-indexer index \
--derived-data ~/Library/Developer/Xcode/DerivedData \
--project-root /path/to/your/project \
--output /path/to/output.scip.db \
--forceGenerate JSON output instead of SQLite:
swift-scip-indexer index \
--derived-data ~/Library/Developer/Xcode/DerivedData \
--project-root /path/to/your/project \
--output /path/to/output.scip.json \
--jsonNote: JSON format is less efficient for large codebases. SQLite format is recommended for projects with more than a few hundred files.
Get detailed information about the indexing process:
swift-scip-indexer index \
--derived-data ~/Library/Developer/Xcode/DerivedData \
--project-root /path/to/your/project \
--output /path/to/output.scip.db \
--verboseIndex only specific modules:
swift-scip-indexer index \
--derived-data ~/Library/Developer/Xcode/DerivedData \
--project-root /path/to/your/project \
--output /path/to/output.scip.db \
--module MyModule --module AnotherModuleExclude code snippets from occurrences (reduces output size):
swift-scip-indexer index \
--derived-data ~/Library/Developer/Xcode/DerivedData \
--project-root /path/to/your/project \
--output /path/to/output.scip.db \
--no-include-snippetsThe indexer automatically detects your current git branch and maintains separate index caches for each branch. This enables:
- Fast Branch Switching: When switching to a previously indexed branch, the index is restored instantly from cache
- Efficient Updates: Only changed files are re-indexed when switching branches
- Automatic State Management: Index state is tracked per branch and commit
Branch caches are stored in .swift-scip-index/branches/ within your project root.
- Reads Index Store: The tool reads from Xcode's IndexStoreDB, which contains symbol and occurrence information from your project's build
- Extracts Data: Collects symbols (classes, functions, variables, etc.), their occurrences (definitions and references), and relationships
- Generates SCIP: Converts the index store data into SCIP format
- Writes Output: Saves the index as either SQLite database or JSON file
The SQLite format (.db) provides:
- Efficient storage (~30-50% smaller than JSON)
- Fast queries without loading entire database
- Incremental updates
- Scalability for large codebases (100GB+)
The JSON format (.json) is available for compatibility but is less efficient for large projects.
The indexer stores its state in .swift-scip-index/ within your project root:
.swift-scip-index/
├── branches/
│ ├── main/
│ │ └── index.db
│ └── feature-branch/
│ └── index.db
└── state.json (legacy, if present)
Make sure:
- Your project has been built in Xcode at least once
- The DerivedData path is correct
- The DerivedData folder contains your project's build artifacts
Incremental and branch-aware features require a git repository. The tool will fall back to legacy mode for non-git projects.
- Use
--incrementalflag for faster subsequent runs - Consider using SQLite format instead of JSON
- Use
--moduleto index only specific modules
- SCIP - Source Code Intelligence Protocol
- IndexStoreDB - Swift Index Store Database library