Carthage cheat sheet
Carthage is fantastic for package management and 90% of the time I only need to execute
carthage update but once in a while, I need to do something more specific so here are all those commands I can never seem to remember.
All You Need to Know
Build Phases. Click "+" icon and choose
Run Script. Create a Run Script and paste.
Use Case #1
If I'm working with a another team and I need to evaluate their work, I won't use update, I'll use bootstrap instead. This ensures that I'm using the exact same dependecies that the other team is using.
carthage bootstrap --platform ios
Use Case 2
I use this command all the time. Which says to update the app with the latest dependencies and create
.framework builds for the iOS platform. Warning, this requires a lot of time.
carthage update --platform ios --no-use-binaries --verbose
Bootstrap vs. Update
Cartfile.resolved, checks out and builds the dependencies at the versions listed.
Cartfile, runs a dependency resolver and checks out dependencies recursively â€“generally aiming for the newest versions that are compatibleâ€“Â and rebuild the project's dependencies.
This ensures that carthage doesn't skip over anything and builds the frameworks. You might want to use that with
--no-use-binaries. This may take time.
carthage build --no-skip-current
Using Parameters (Flags)
Build for a specific platform
Build for iPhone platform.
carthage [update|bootstrap] --platform ios
Build for Mac desktop platform.
carthage [update|bootstrap] --platform macos
Build for all platforms.
carthage [update|bootstrap] --platform all
Download the dependencies as submodules
If you use this --flag, this makes the dependencies available as Git submodules. This allows you to make changes in the dependencies, and commit and push those changes upstream.
carthage [update|bootstrap] --use-submodules
Don't be lazy and simply check out the binary frameworks
Use this flag to ensure all the workspace dependencies get checked out. Otherwise carthage will default to the binary framework releases.
carthage [update|bootstrap] --no-use-binaries
Skip building the dependencies
This is a real time saver. You can download the dependencies but not build the
.framework file. This will also skip the creation of a
carthage [update|bootstrap] --no-build
Only update this specific library
Instead of downloading and re-building all the dependencies, you can just specify which dependency to build.
carthage update [name of library]
Spell out everything that is happening.
carthage update --verbose
Create a Cartfile
Create a normal
You will create a normal Cartfile 95% of the time.
Create a private Cartfile
If you plan to install a test framework, this is the best way to do it. It allows you to use specific dependencies during development without having to build them for production.
Paste this inside of
github "Quick/Quick" github "Quick/Nimble"
Dependency Origin vs. Version
Checkout a dependency from
github "duemunk/Async" "feature/Swift_3.0"
Compatible with version 0.9.2
github "jdg/MBProgressHUD" ~> 0.9.2
At least version 2.3.1
github "ReactiveCocoa/ReactiveCocoa" >= 2.3.1
Exactly version 0.4.1
github "jspahrsummers/libextobjc" == 0.4.1