Carthage: A Decentralized iOS Dependency Manager
Carthage is a dependency manager that prioritizes developer control. It compiles dependencies into binary frameworks but leaves final integration to you, avoiding automatic changes to your Xcode project.
WHY IT EXISTS Carthage was created to be a simpler, less invasive way to manage dependencies for Cocoa applications. It provides an alternative to tools like CocoaPods by giving developers full control over their project structure, refusing to automatically modify Xcode project files or build settings.
THE MENTAL MODEL Think of Carthage as a build tool, not a project manager. You give it a list of dependencies in a Cartfile, and it fetches and compiles them into binary frameworks. It then hands these frameworks back to you to integrate manually. It's decentralized because it pulls directly from Git repositories without a central registry.
HOW IT WORKS You create a plain text file named Cartfile that lists your project's dependencies. For example: github "Alamofire/Alamofire" ~> 5.0. Running carthage update fetches the source from the Git repositories, checks out the specified versions, and builds each one into a binary framework (.framework or .xcframework). These compiled binaries are placed in a new Carthage/Build/ directory. From there, you are responsible for dragging the framework into your Xcode project's settings to link and embed it.
WHEN TO USE IT Use Carthage when you want explicit control over your project's setup and want to avoid the "magic" of tools that automatically create and manage Xcode workspaces. It's a good fit for developers who prefer to understand exactly how dependencies are integrated and want to keep their project files clean and self-contained.
WHEN NOT TO USE IT Avoid Carthage if you prefer a fully automated, one-command setup. The manual integration step can be error-prone for those unfamiliar with Xcode's build settings. With the rise of the Swift Package Manager (SPM), which is integrated directly into Xcode, Carthage is a less common choice for new projects.
ONE CANONICAL EXAMPLE A developer wants to add the Alamofire networking library. They add the line github "Alamofire/Alamofire" to their Cartfile and run carthage update. Carthage creates a Carthage/Build/ folder containing Alamofire.xcframework. The developer then drags this file from Finder into their app target's "Frameworks, Libraries, and Embedded Content" section in Xcode.
Read the original → github.com
Get five bites like this every day.
Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.