spm_resolve
Resolve and fetch all Swift Package Manager (SPM) dependencies defined in your Xcode project or Package.swift file. This downloads the exact package versions specified in Package.resolved, ensuring your dependency graph is complete and ready for building. Use this after cloning a repository, switching branches, or when Xcode reports missing packages.
Parameters
Section titled “Parameters”| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
projectPath | string | No | — | Absolute path to the .xcodeproj, .xcworkspace, or directory containing Package.swift. If omitted, uses the current working directory. |
scheme | string | No | — | The Xcode scheme to resolve dependencies for. Useful when a workspace contains multiple projects with different dependency trees. |
clonedSourcePackagesDir | string | No | — | Custom directory to store cloned package sources. Useful for CI caches or shared builds. |
Usage Examples
Section titled “Usage Examples”Resolve packages for an Xcode project
Section titled “Resolve packages for an Xcode project”“Resolve all Swift packages for my project”
{ "projectPath": "/Users/johndoe/Projects/MyApp/MyApp.xcodeproj"}Resolve packages for a specific scheme
Section titled “Resolve packages for a specific scheme”“Resolve SPM dependencies for the MyApp-Dev scheme”
{ "projectPath": "/Users/johndoe/Projects/MyApp/MyApp.xcworkspace", "scheme": "MyApp-Dev"}Resolve with a custom package cache directory
Section titled “Resolve with a custom package cache directory”“Resolve packages and store them in our CI cache folder”
{ "projectPath": "/Users/johndoe/Projects/MyApp/MyApp.xcodeproj", "clonedSourcePackagesDir": "/Users/johndoe/Projects/MyApp/.spm-cache"}Resolve a Swift package library
Section titled “Resolve a Swift package library”“Resolve dependencies for my Swift package”
{ "projectPath": "/Users/johndoe/Projects/MyLibrary"}Example Output
Section titled “Example Output”Resolving Swift Package Manager dependencies...Project: /Users/johndoe/Projects/MyApp/MyApp.xcodeproj
Fetching https://github.com/Alamofire/Alamofire.gitFetching https://github.com/SnapKit/SnapKit.gitFetching https://github.com/onevcat/Kingfisher.gitFetching https://github.com/apple/swift-collections.git
Resolved 4 packages: Alamofire 5.9.1 SnapKit 5.7.1 Kingfisher 8.1.0 swift-collections 1.1.4
All packages resolved successfully.Related Tools
Section titled “Related Tools”spm_update— Update packages to the latest compatible versionsspm_show_dependencies— View the full dependency treebuild_app— Build the project after resolving dependencies