Cette page est affichée en anglais. Une traduction française est en cours.
ConfigsJul 6, 2026·3 min de lecture

Carthage — Decentralized Dependency Manager for Cocoa

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

Prêt pour agents

Installation agent prête

Cet actif peut être installé après choix du runtime, vérification du plan et exécution de la commande adaptée.

Native · 98/100Policy : autoriser
Surface agent
Tout agent MCP/CLI
Type
Skill
Installation
Single
Confiance
Confiance : Established
Point d'entrée
Carthage Overview
Commande d'installation directe
npx -y tokrepo@latest install 47df858d-7959-11f1-9bc6-00163e2b0d79 --target codex

À exécuter après confirmation du plan en 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

Fil de discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires