Home / Programming /

Carthage Setup Cheatsheet

Setup cheats

  1. Create cartfile and add libraries
  2. run carthage update (or carthage bootstrap if working from an existing project)
  3. You may need to wait for the build to finish to be able to add the frameworks to your Xcode project, but you may proceed with the following in general in the meantime
  4. if you are doing iOS, these are your instructions (for macOS skip to the next step):

    1. In Xcode, for each target, add a Run Script build phase

      1. Suggestion: rename the phase to something like Run Script - Carthage
      2. put the following in script portion:

        /usr/local/bin/carthage copy-frameworks
        /usr/local/bin/carthage outdated --xcode-warnings
      3. Use the following template (for iOS, modify appropriately for others), based off of the built framework name(s), and add the following entry to Input Files for each framework (you can find the built framework names by going to Carthage/Build/*/[frameworksHere] )
        • $(SRCROOT)/Carthage/Build/iOS/[frameworkNameNoBrackets].framework
      4. Use the following template and do the same for Output Files
        • $(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/[frameworkNameNoBrackets].framework
    2. In the General tab of the Xcode target, drag the frameworks from Carthage/Build/[build platform]/[frameworksHere] to the Linked Frameworks and Libraries section
      • You should not need to copy files
    3. (wait for carthage update to finish first) Build your project to make sure everything is working right
  5. for macOS, simply drop the built frameworks from the Carthage/Build folder into the macOS build target's Embedded Binaries.

Supporting Carthage in your framework

  1. Double check permission levels
  2. Make sure to share you set your build scheme to Shared
  3. run carthage build --no-skip-current in the project directory to confirm everything builds fine

More information is available here.


this document last modified: March 24 2020 00:34

Home / Programming /