Carthage Overview: Managing Swift application dependencies

In this lesson

Carthage is a decentralized dependency manager for your iOS applications. This lesson will give you a basic overview of Carthage and how to install it so that you can use it for your own projects.


Tap on time to skip ahead


Hello everyone. So you want to learn about Carthage? What is Carthage? Well, according to the website here on GitHub, on their open source project, it is a simple, decentralized dependency manager for Cocoa. That means, we can use it for iOS.


What exactly does that mean? Well, if you’ve developed in any other languages, like Ruby, you’ve probably heard of Ruby Gems. There’s also Apache Maven for Java, Node Package Manager for Javascript development and Gradle for Android. All of those are very similar, at least in some respect, to Carthage.


If you’re like many iOS developers, your application depends heavily on third party dependencies, like RxSwift, which provides reactive extensions for your applications. Or maybe you want to use Alamofire, elegant HTTP networking in Swift. Or you might want to use SwiftyBeaver for your logging needs and enhance your testing with the Quick framework.


I’m going to show you how to use Carthage to gather, manage and build your external dependencies.


Before we can use Carthage, we have to install it. I’m looking at the Carthage GitHub repo README, under the Installing Carthage section, and you’ll notice that there are two different ways. The first way, which is required if you’re running Xcode version prior to 7, so 6 or before, is to download this Carthage package file and simply double click it to install.


A better way, in my opinion, if you’re using Xcode 7 or greater, you can use Homebrew to install Carthage. This is better because you can use Homebrew to update Carthage when new versions become available.


In order to install Carthage using Homebrew, I’m going to open up my handy dandy terminal window and I’m simply going to type “brew install carthage” and hit enter. It’s as simple as that. Brew will download and install Carthage and have it ready for your use. I already have Carthage installed so I’m going to skip that step. In order to verify that it’s been installed correctly, you can simply type “carthage version” and it should print out the current version that Brew installed for you. Now we’re ready to go.

Additional Info

Register to get access to additional resources and info.