Configs2026年7月6日·1 分钟阅读

Carthage — Decentralized Dependency Manager for Cocoa

A simple dependency manager for macOS and iOS that builds frameworks without altering your Xcode project structure.

Agent 就绪

Agent 可直接安装

这个资产可安装;Agent 先选择当前运行时、检查安装计划,再运行匹配命令。

Native · 98/100策略:允许
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Single
信任
信任等级:Established
入口
Carthage Overview
直接安装命令
npx -y tokrepo@latest install 47df858d-7959-11f1-9bc6-00163e2b0d79 --target codex

先 dry-run 确认安装计划,再运行此命令。

Introduction

Carthage takes a deliberately minimal approach to dependency management for Apple platforms. Unlike centralized package managers, it fetches source code from Git repositories, builds frameworks, and leaves your Xcode project files untouched. You stay in control of your build settings.

What Carthage Does

  • Resolves and fetches dependencies declared in a simple Cartfile
  • Builds each dependency into pre-compiled XCFrameworks
  • Produces a Cartfile.resolved lock file for reproducible builds
  • Supports GitHub, GitLab, and any arbitrary Git URL as sources
  • Works alongside Swift Package Manager and CocoaPods without conflicts

Architecture Overview

Carthage reads your Cartfile, resolves the dependency graph using semantic versioning constraints, then checks out each repository at the resolved version. It invokes xcodebuild to compile each dependency into an XCFramework. The resulting binaries go into Carthage/Build, and you link them manually, keeping your .xcodeproj clean of third-party build phases.

Self-Hosting & Configuration

  • Install via Homebrew: brew install carthage
  • Create a Cartfile listing each dependency (GitHub shorthand or full Git URLs)
  • Run carthage update --use-xcframeworks to build
  • Link the generated XCFrameworks in Xcode under Frameworks, Libraries, and Embedded Content
  • Use carthage bootstrap in CI for reproducible builds from the lock file

Key Features

  • Zero modification to your .xcodeproj or workspace
  • Builds XCFrameworks that work across iOS, macOS, tvOS, watchOS, and visionOS
  • Supports binary caching to skip rebuilding unchanged dependencies
  • Decentralized model with no central registry required
  • Cartfile syntax is intentionally simple and human-readable

Comparison with Similar Tools

  • Swift Package Manager — Apple-official and integrated into Xcode; less flexible with non-Swift dependencies
  • CocoaPods — centralized spec repo with richer plugin ecosystem; modifies your Xcode workspace
  • Mint — focuses on Swift CLI tool installation, not framework dependency management
  • Accio — SPM-based but builds XCFrameworks like Carthage; smaller community
  • Tuist — project generation tool that can also manage dependencies; broader scope

FAQ

Q: Does Carthage support Swift Package Manager packages? A: Not directly. Carthage resolves from Git repos with Xcode projects. If a library only provides a Package.swift, use SPM instead.

Q: How do I speed up Carthage builds in CI? A: Cache the Carthage/Build directory between runs, and use carthage bootstrap instead of carthage update to respect the lock file.

Q: Is Carthage still actively maintained? A: The project receives community maintenance and is compatible with current Xcode and Swift releases.

Q: Can I use Carthage and CocoaPods in the same project? A: Yes. Carthage manages its own build output directory and does not interfere with CocoaPods' Pods workspace integration.

Sources

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产