Skip to main content

Managing dependencies with Carthage

Carthage is a dependency manager for iOS and macOS. It's a decentralized dependency manager that doesn't alter your Xcode project in any way. You can use it on Bitrise, too, to handle dependencies for your iOS apps.

Installing Carthage dependenciesClick to copy link

To install your dependencies with Carthage:

  1. Make sure you have a Cartfile included in your project.

  2. Add the Carthage Step to your Workflow.

    It should come after any Step that pulls from the cache. If you don't have any caching Steps, add the Step right after the Git Clone Repository Step.

  3. In the Carthage command to run input, select the command you wish to run.

    carthage-command.png

    The default value is bootstrap.

    For a list of available commands, run carthage help on a device with Carthage installed.

  4. You can add options to the Carthage call in the Additional options for carthage command input.

    For example, the --platform ios flag ensures that only the iOS version of frameworks will be installed.

Caching Carthage dependenciesClick to copy link

With key-based caching, you only need the Restore Carthage cache and the Save Carthage cache Steps to cache your dependencies. These Steps require no configuration as they automatically set up the cache keys and cache paths.

  1. Add the Restore Carthage cache Step to your Workflow

    carthage-command.png

    It should come before the Carthage Step or any Step that needs dependencies to build your app, such as Xcode Archive & Export for iOS.

  2. Add the Save Carthage cache Step to the end of your Workflow.