The Swift Package Manager is a tool for managing distribution of source code, aimed at making it easy to share your code and reuse others’ code. The tool directly addresses the challenges of compiling and linking Swift packages, managing dependencies, versioning, and supporting flexible distribution and collaboration models.
We’ve designed the system to make it easy to share packages on services like GitHub, but packages are also great for private personal development, sharing code within a team, or at any other granularity.
Swift Package Manager includes a build system that can build for macOS and Linux. Starting with Xcode 11, Xcode integrates with SwiftPM to provide support for including packages in iOS, macOS, watchOS, and tvOS applications.
The SourceKit-LSP project leverages libSwiftPM and provides Language Server Protocol implementation for editors that support LSP.
Please use this guide for learning package manager basics.
For Quick Help use the swift package --help
command.
For documentation on using Swift Package Manager, creating packages, and more, see the documentation directory.
For documentation on developing the Swift Package Manager itself, see the contribution guide.
For detailed documentation on the package manifest API, see PackageDescription API.
For release notes with information about changes between versions, see the release notes.
The package manager’s system requirements are the same as those for Swift with the caveat that the package manager requires Git at runtime as well as build-time.
The package manager is available as part the Swift toolchains available on Swift.org) including snapshots for the latest versions built from main
branch. For installation instructions for downloaded snapshots, please see the Getting Started section of Swift.org.
The Swift Package Manager is also included in Xcode 8.0 and all subsequent releases.
You can verify your installation by typing swift package --version
in a terminal:
$ swift package --version
Apple Swift Package Manager - ...
There are several ways to contribute to Swift Package Manager. To learn about the policies, best practices that govern contributions to the Swift project and instructions for setting up the development environment please read the Contributor Guide.
The Swift package manager uses llbuild as the underlying build system for compiling source files. It is also open source and part of the Swift project.
If you have any trouble with the package manager, help is available. We recommend:
When reporting an issue please follow the bug reporting guidelines, they can be found in contribution guide.
If you’re not comfortable sharing your question with the list, contact details for the code owners can be found in CODEOWNERS; however, Swift Forums is usually the best place to go for help.
Copyright 2015 - 2023 Apple Inc. and the Swift project authors. Licensed under Apache License v2.0 with Runtime Library Exception.
See https://swift.org/LICENSE.txt for license information.
See https://swift.org/CONTRIBUTORS.txt for Swift project authors.
link |
Stars: 9592 |
Last commit: 18 minutes ago |
#7010
On macOS, swift build
and swift run
now produce binaries that allow backtraces in debug builds. Pass SWIFT_BACKTRACE=enable=yes
environment variable to enable backtraces on such binaries when running them.
#7101
Binary artifacts are now cached alongside repository checkouts so they do not need to be re-downloaded across projects.
canImport
not work by @abertelrud in https://github.com/apple/swift-package-manager/pull/6323remove
command message by @MaxDesiatov in https://github.com/apple/swift-package-manager/pull/6319FileSystem
as Sendable
by @MaxDesiatov in https://github.com/apple/swift-package-manager/pull/6318DiagnosticsEngine
in Observability
by @MaxDesiatov in https://github.com/apple/swift-package-manager/pull/6333PackageBuilder.swift
by @MaxDesiatov in https://github.com/apple/swift-package-manager/pull/6360ZipArchiver
by @MaxDesiatov in https://github.com/apple/swift-package-manager/pull/6366PackageVersionMetadata
from PackageSearchClient
) by @neonichu in https://github.com/apple/swift-package-manager/pull/6351.tar.gz
archives by @MaxDesiatov in https://github.com/apple/swift-package-manager/pull/6368swift-experimental-destination
invocations by @MaxDesiatov in https://github.com/apple/swift-package-manager/pull/6382FileManager
instead of cp
by @compnerd in https://github.com/apple/swift-package-manager/pull/4872SigningEntityType
as Sendable
by @MaxDesiatov in https://github.com/apple/swift-package-manager/pull/6390supportedExtensions
in UniversalArchiver
constant by @MaxDesiatov in https://github.com/apple/swift-package-manager/pull/6388DestinationBundleTests
by @MaxDesiatov in https://github.com/apple/swift-package-manager/pull/6391SwiftTool
by @MaxDesiatov in https://github.com/apple/swift-package-manager/pull/6396DriverKit
instead of driverKit
by @abertelrud in https://github.com/apple/swift-package-manager/pull/6405UniversalArchiver
in install
command by @MaxDesiatov in https://github.com/apple/swift-package-manager/pull/6392AsyncFileSystem
as unused by @MaxDesiatov in https://github.com/apple/swift-package-manager/pull/6436case
of switch
in BuildPlan.swift
by @MaxDesiatov in https://github.com/apple/swift-package-manager/pull/6389SigningEntity
via package metadata by @neonichu in https://github.com/apple/swift-package-manager/pull/6442testPluginCanBeReferencedByProductName
by @neonichu in https://github.com/apple/swift-package-manager/pull/6443-Xmanifest
flag by @MaxDesiatov in https://github.com/apple/swift-package-manager/pull/6435testImportOfMissedDepWarning
by @neonichu in https://github.com/apple/swift-package-manager/pull/6479GenerateLinuxMain
by @MaxDesiatov in https://github.com/apple/swift-package-manager/pull/6490first
rather than indexing by @compnerd in https://github.com/apple/swift-package-manager/pull/6502first
rather than indexing by @compnerd in https://github.com/apple/swift-package-manager/pull/6503CommandsTests
behind SWIFTCI_DISABLE_SDK_DEPENDENT_TESTS
by @neonichu in https://github.com/apple/swift-package-manager/pull/6507useBuiltinFSMonitor
to fsmonitor
by @compnerd in https://github.com/apple/swift-package-manager/pull/6549PluginNetworkPermissionScope
. by @zkiraly in https://github.com/apple/swift-package-manager/pull/6555-lc++
based on run-time triple by @MaxDesiatov in https://github.com/apple/swift-package-manager/pull/6581Triple
formatting in error messages by @MaxDesiatov in https://github.com/apple/swift-package-manager/pull/6544SwiftSDKBundleTests
by @MaxDesiatov in https://github.com/apple/swift-package-manager/pull/6588build-using-self
by @neonichu in https://github.com/apple/swift-package-manager/pull/6594swift-certificates
0.6.0
by @dnadoba in https://github.com/apple/swift-package-manager/pull/6528withLock
should be marked as having a discardable result by @neonichu in https://github.com/apple/swift-package-manager/pull/6615RelativePath.init
by @MaxDesiatov in https://github.com/apple/swift-package-manager/pull/6620Documentation/Registry.md
by @revolter in https://github.com/apple/swift-package-manager/pull/6628async
by @MaxDesiatov in https://github.com/apple/swift-package-manager/pull/6623mtime
updates by @compnerd in https://github.com/apple/swift-package-manager/pull/6655-debug-format
option by @compnerd in https://github.com/apple/swift-package-manager/pull/6659visionOS
as a platform alongside iOS
, tvOS
, watchOS
, and the others by @abertelrud in https://github.com/apple/swift-package-manager/pull/6662swiftpm-xctest-helper
by @neonichu in https://github.com/apple/swift-package-manager/pull/6667.librarian
for toolsets by @compnerd in https://github.com/apple/swift-package-manager/pull/6688-debug-info-format none
for Windows by @compnerd in https://github.com/apple/swift-package-manager/pull/6702Destination
type to SwiftSDK
by @MaxDesiatov in https://github.com/apple/swift-package-manager/pull/6707Foundation.URL
by @neonichu in https://github.com/apple/swift-package-manager/pull/6706RepositorySpecifier.Location.gitURL
by @neonichu in https://github.com/apple/swift-package-manager/pull/6725SerializedJSON
type as string literal escaping helper by @MaxDesiatov in https://github.com/apple/swift-package-manager/pull/6730-use-ld=lld
from swift-symbolgraph-extract
by @compnerd in https://github.com/apple/swift-package-manager/pull/6742swift-frontend
warning by @neonichu in https://github.com/apple/swift-package-manager/pull/6759InstalledPackages.swift
by @MaxDesiatov in https://github.com/apple/swift-package-manager/pull/6775-framework
on platforms that support frameworks by @neonichu in https://github.com/apple/swift-package-manager/pull/6778emitSwiftModuleSeparately
option by @neonichu in https://github.com/apple/swift-package-manager/pull/6779-user-module-version
for any version-based package by @neonichu in https://github.com/apple/swift-package-manager/pull/6781-user-module-version
by @neonichu in https://github.com/apple/swift-package-manager/pull/6795SWIFTPM_LLBUILD_FWK
case by @neonichu in https://github.com/apple/swift-package-manager/pull/6809getHostTriple()
by @neonichu in https://github.com/apple/swift-package-manager/pull/6855swift package plugin --list
by @neonichu in https://github.com/apple/swift-package-manager/pull/6805availableCommandPlugins()
by @neonichu in https://github.com/apple/swift-package-manager/pull/6806swift-get-version
in SwiftPM by @neonichu in https://github.com/apple/swift-package-manager/pull/6840tripleString(forPlatformVersion:)
by @kabiroberai in https://github.com/apple/swift-package-manager/pull/6834fatalError
with Swift
by @neonichu in https://github.com/apple/swift-package-manager/pull/6847dummy-swiftc
by @neonichu in https://github.com/apple/swift-package-manager/pull/6867LLBuildManifestBuilder.swift
by @ncooke3 in https://github.com/apple/swift-package-manager/pull/6826platforms
declaration in IntegrationTests
package by @neonichu in https://github.com/apple/swift-package-manager/pull/6873swiftResourcesPath
by @kabiroberai in https://github.com/apple/swift-package-manager/pull/6717IncrementalBuildTests
in unsupported environments by @neonichu in https://github.com/apple/swift-package-manager/pull/6885from
arguments in PackageDependency's comments by @bc-lee in https://github.com/apple/swift-package-manager/pull/6876--test-product
option by @neonichu in https://github.com/apple/swift-package-manager/pull/6892README.md
by @MaxDesiatov in https://github.com/apple/swift-package-manager/pull/6895allTargets
by @neonichu in https://github.com/apple/swift-package-manager/pull/6776BuildParameters.forTriple()
by @neonichu in https://github.com/apple/swift-package-manager/pull/6900swift-plugin-server
on demand by @neonichu in https://github.com/apple/swift-package-manager/pull/6899moduleAliases
should be internal by @neonichu in https://github.com/apple/swift-package-manager/pull/6917toolset.linker.path
not passed to -ld-path
by @kabiroberai in https://github.com/apple/swift-package-manager/pull/6719-suppress-warnings
to work if it doesn't work by @neonichu in https://github.com/apple/swift-package-manager/pull/6930Triple
tests by @MaxDesiatov in https://github.com/apple/swift-package-manager/pull/6932BuildPlan
by @neonichu in https://github.com/apple/swift-package-manager/pull/6933toolset.linker.path
not passed to -ld-path
(#6719)" by @neonichu in https://github.com/apple/swift-package-manager/pull/6939platforms
declaration in IntegrationTests
package (#6873)" by @neonichu in https://github.com/apple/swift-package-manager/pull/6934swift experimental-sdk list
stdout output by @MaxDesiatov in https://github.com/apple/swift-package-manager/pull/6942Utilities/build_ubuntu_cross_compilation_toolchain
by @MaxDesiatov in https://github.com/apple/swift-package-manager/pull/6943Triple
tests by @MaxDesiatov in https://github.com/apple/swift-package-manager/pull/6842main
into release/5.10
by @MaxDesiatov in https://github.com/apple/swift-package-manager/pull/6953Data
conversion by @zunda-pixel in https://github.com/apple/swift-package-manager/pull/6952Usage.md
by @BrianHenryIE in https://github.com/apple/swift-package-manager/pull/6944mirrorIndex
in DependencyMirrors
by @neonichu in https://github.com/apple/swift-package-manager/pull/6964LLBuildManifestBuilder.swift
into extension files by @MaxDesiatov in https://github.com/apple/swift-package-manager/pull/6966triple
property deprecation warnings by @MaxDesiatov in https://github.com/apple/swift-package-manager/pull/6971didFinishCommand
by @omochi in https://github.com/apple/swift-package-manager/pull/6757*.sdk
paths from pkgConfig files to the current SDK by @fwcd in https://github.com/apple/swift-package-manager/pull/6772WriteAuxiliary.EntitlementPlist
by @MaxDesiatov in https://github.com/apple/swift-package-manager/pull/6975Target.swift
and BuildPlan.swift
by @MaxDesiatov in https://github.com/apple/swift-package-manager/pull/6972BuildSystemProvider.Provider
a protocol by @MaxDesiatov in https://github.com/apple/swift-package-manager/pull/6984--show-sdk-platform-path
issues by @neonichu in https://github.com/apple/swift-package-manager/pull/6977BuildParameters
properties into separate structs by @MaxDesiatov in https://github.com/apple/swift-package-manager/pull/6976SwiftcImportScanner
by @MaxDesiatov in https://github.com/apple/swift-package-manager/pull/6996IntegrationTests/SwiftPMTests.swift
by @MaxDesiatov in https://github.com/apple/swift-package-manager/pull/6999Workspace+Manifests.swift
by @MaxDesiatov in https://github.com/apple/swift-package-manager/pull/7000PluginScriptRunner.swift
comments by @MaxDesiatov in https://github.com/apple/swift-package-manager/pull/7008InitPackage.swift
by @MaxDesiatov in https://github.com/apple/swift-package-manager/pull/7013TSCUtility.Diagnostics{Engine,}
by @MaxDesiatov in https://github.com/apple/swift-package-manager/pull/7019TestBuildCommand.indent
function by @MaxDesiatov in https://github.com/apple/swift-package-manager/pull/7017is-mutated
/is-command-timestamp
nodes by @MaxDesiatov in https://github.com/apple/swift-package-manager/pull/7020testInstallRemote
correctly by @neonichu in https://github.com/apple/swift-package-manager/pull/7024testPackageContextName
fails by @neonichu in https://github.com/apple/swift-package-manager/pull/7025Workspace.swift
into smaller files by @MaxDesiatov in https://github.com/apple/swift-package-manager/pull/7006isValidDirectory
and isValidRefFormat
should be throwing by @neonichu in https://github.com/apple/swift-package-manager/pull/7033*get-task-allow-entitlement
flags by @MaxDesiatov in https://github.com/apple/swift-package-manager/pull/7028testCommandPluginInvocation
by @neonichu in https://github.com/apple/swift-package-manager/pull/7051toolset.linker.path
not passed to -ld-path
by @MaxDesiatov in https://github.com/apple/swift-package-manager/pull/7021--toolchain
path doesn't exist by @MaxDesiatov in https://github.com/apple/swift-package-manager/pull/7058Documentation/Usage.md
by @MaxDesiatov in https://github.com/apple/swift-package-manager/pull/7059PIFBuilder.swift
by @MaxDesiatov in https://github.com/apple/swift-package-manager/pull/7067Toolset.init(toolchainBinDir:buildFlags:)
public by @MaxDesiatov in https://github.com/apple/swift-package-manager/pull/7064testDownloadDefaultAuthenticationSuccess
on CI by @neonichu in https://github.com/apple/swift-package-manager/pull/7071testPackageNameFlag
by @neonichu in https://github.com/apple/swift-package-manager/pull/7075LLBuildManifestTests
to test plan by @neonichu in https://github.com/apple/swift-package-manager/pull/7077--experimental-lto-mode
option by @MaxDesiatov in https://github.com/apple/swift-package-manager/pull/7166file-system
as device-agnostic
in build manifest by @MaxDesiatov in https://github.com/apple/swift-package-manager/pull/7189-disable-sandbox
to Swift compiler if requested by @neonichu in https://github.com/apple/swift-package-manager/pull/7227codesign
messages by @neonichu in https://github.com/apple/swift-package-manager/pull/7295supportsSDKDependentTests()
by @neonichu in https://github.com/apple/swift-package-manager/pull/7308Full Changelog: https://github.com/apple/swift-package-manager/compare/swift-5.9.2-RELEASE...swift-5.10-RELEASE
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics