Linux command
carthage 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Update and build dependencies
carthage update
Build XCFrameworks
carthage update --use-xcframeworks
Bootstrap without updating
carthage bootstrap
Build specific dependency
carthage build [dependency_name]
Update without building
carthage update --no-build
Build for specific platform
carthage update --platform [iOS]
Check outdated dependencies
carthage outdated
说明
carthage is a decentralized dependency manager for Swift and Objective-C Cocoa projects. Unlike CocoaPods, it builds dependencies as binary frameworks without modifying your Xcode project files, workspace, or build settings, leaving full control of the project structure to the developer. Dependencies are declared in a Cartfile using a simple syntax that supports GitHub repositories, Git URLs, and binary-only frameworks. Running `carthage update` resolves versions, checks out sources, and builds frameworks into the Carthage/Build directory. A Cartfile.resolved lockfile ensures reproducible builds across team members. Since version 0.37.0, Carthage supports building XCFrameworks, which bundle binaries for multiple platforms and architectures into a single distributable package.
参数
- --use-xcframeworks
- Build as XCFrameworks (recommended)
- --platform _name_
- Build for specific platform (iOS, macOS, tvOS, watchOS)
- --no-build
- Skip building after checkout
- --no-use-binaries
- Build from source, don't use prebuilt binaries
- --cache-builds
- Cache built frameworks
- --project-directory _path_
- Directory containing Cartfile
- --verbose
- Show detailed output
FAQ
What is the carthage command used for?
carthage is a decentralized dependency manager for Swift and Objective-C Cocoa projects. Unlike CocoaPods, it builds dependencies as binary frameworks without modifying your Xcode project files, workspace, or build settings, leaving full control of the project structure to the developer. Dependencies are declared in a Cartfile using a simple syntax that supports GitHub repositories, Git URLs, and binary-only frameworks. Running `carthage update` resolves versions, checks out sources, and builds frameworks into the Carthage/Build directory. A Cartfile.resolved lockfile ensures reproducible builds across team members. Since version 0.37.0, Carthage supports building XCFrameworks, which bundle binaries for multiple platforms and architectures into a single distributable package.
How do I run a basic carthage example?
Run `carthage update` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does --use-xcframeworks do in carthage?
Build as XCFrameworks (recommended)