Faster builds in Xcode with Carthage.

Let me tell you this straight away! Carthage + Rome gave us close to 2.5x faster builds. Well, that’s a huge performance bump if you are dealing with a large project.

Cocoapods was a natural first choice

At Pulse, we installed third-party libraries using cocoa pods which were a natural choice when we began writing our iOS apps. Eventually, the project grew in size with larger dependencies like Firebase, AsyncDisplayKit, Realm, RxSwift and 24 others. Project compile times started getting worse and hindered developer productivity. A few developers with 2015 MacBook Pros started mentioning that the project would take around 40 minutes for a clean build.
With Xcode’s inability to keep the code suggestions straight, developers usually build their project to check for code linting and compilation errors, so this was becoming a huge problem.

First encounter with Carthage

At first, it took me some time to setup Carthage along with Cocoapods. I ran into issues where neither Cocoapods nor Carthage resolves common parent dependencies from other libraries. This causes problems especially when you have two versions of the same parent dependency being used in multiple libraries.

Upon further research, I realized I was doing it wrong. I didn’t have to run `carthage update` every time rather I just had to run `carthage bootstrap` while setting it up on a new machine.

This cheat sheet helped me a lot throughout this entire process.
Carthage cheat sheet

I started moving all my RxSwift and related dependencies to Carthage. I immediately saw a ridiculous decrease in clean build times and continued moving everything else to my `Cartfile`

The results were amazing, the team was very happy and it ultimately helped increase developer productivity.

CI became slower than a snail

We use Bitrise for CI/CD. The build time became even slower with Carthage for some reason. We were running `carthage bootstrap` every time a new CI build was triggered. This step itself was taking close 40 minutes. I figured if I could cache all my framework builds and reuse them in subsequent builds then it would save a lot of time.

I started looking for solutions and found this awesome tool called Rome. Rome was very easy to set up and the thing which I loved the most about this tool was the version resolution. Rome uses Amazon S3 buckets to store the compiled frameworks and dSYMs. Later you could just run `rome download` to download all the precompiled frameworks.

After integrating Rome, Carthage builds went out of the picture as I only had to compile my frameworks once.


The total build time on Bitrise was around 65 minutes with Carthage which reduced down to 17 minutes after this complete setup. Isn’t that incredible?

If you have a huge project with a lot of external dependencies, then you should try this out. I hope this helps everyone to deal with non-productive problems that come along with iOS Development.

Would also love to hear what other solutions you guys came up with to reduce build times.


Feel free to leave a comment if you have any doubts. Don’t hold back for claps :)