carthage

Learn how to use Carthage, a dependency manager for Cocoa applications. Explore commands for updating, bootstrapping, and building dependencies for iOS and macOS.

Carthage

Carthage is a decentralized dependency manager for Cocoa applications (Mac OS X, iOS, tvOS, watchOS). It simplifies the process of integrating third-party libraries into your projects by building them as frameworks.

Carthage Commands Overview

Below are common Carthage commands to manage your project's dependencies:

Updating Dependencies

To download and build the latest versions of all dependencies listed in your Cartfile, use the update command:

# Download & build the latest version of all dependencies mentioned in Cartfile
carthage update

You can specify platforms to limit the build process. For example, to update dependencies and build only for iOS:

# Update dependencies, but only build for iOS
carthage update --platform ios

If you only want to download the dependencies without building them, use the --no-build flag:

# Update dependencies, but don't build any of them
carthage update --no-build

Bootstrapping Dependencies

The bootstrap command downloads and builds the current versions of dependencies as specified in your Cartfile, without checking for newer versions. This is useful for setting up a project on a new machine or after cloning a repository.

# Download & rebuild the current version of dependencies (without updating them)
carthage bootstrap

Building Specific Dependencies

To rebuild a particular dependency, you can specify its name:

# Rebuild a specific dependency:
carthage build dependency

Further Resources