Multiple/Duplicate Protobuf Dependencies of Carthage Binary Firebase Components

Step 1: Describe your environment

  • Xcode version: 11.4
  • Firebase SDK version: 6.21.0
  • Firebase Component: Remote Config, Messaging (and all other components depending on Protobuf)
  • Component version: n/a
  • Installation method: Carthage

Step 2: Describe the problem

The usage description of the Carthage documentation states that we should add a subset of the provided components to the Cartfile of a project that uses Firebase as their dependency.

The problem is: Multiple of those components internally depend on Protobuf and all of them bundle their own Protobuf.framework within the zip file used for binary distribution.


├── FirebaseABTesting.framework
├── FirebaseRemoteConfig.framework
└── Protobuf.framework

├── FirebaseMessaging.framework
└── Protobuf.framework

When Carthage downloads these zip files it will extract its contents into the Carthage/Build/<platform> folder.

If a project depends on multiple Firebase components that depend on Protobuf, Carthage will always fail with an error like the following.

Failed to write to /Users/ffittschen/Firebase_Test/Carthage/Build/iOS/Protobuf.framework: Error Domain=NSCocoaErrorDomain Code=513 ““Protobuf.framework” couldn’t be removed because you don’t have permission to access it.” UserInfo={NSUserStringVariant=(
), NSFilePath=/Users/ffittschen/Firebase_Test/Carthage/Build/iOS/Protobuf.framework, NSUnderlyingError=0x7fb827104db0 {Error Domain=NSPOSIXErrorDomain Code=66 “Directory not empty”}}

Steps to reproduce:

  1. Create a Cartfile with this content:
binary ""
binary ""
binary ""
  1. Run carthage update --platform iOS

Proposed solution:

I would like to propose to either distribute Protobuf seperately instead of being bundled within multiple Firebase components, or bundle it with the Firebase Analytics component, which should always be included according to the Carthage documentation.

The Cartfile with a separate Protobuf component could look as follows. If Protobuf would be bundled within the Analytics component, the Cartfile would not look different than existing Cartfiles

Cartfile with separate Protobuf component
binary ""
binary ""
binary ""
binary ""

1 possible answer(s) on “Multiple/Duplicate Protobuf Dependencies of Carthage Binary Firebase Components

  1. Thanks for the report @ffittschen! This is a side-effect as to how we currently build and package the zip file (which turns into the Carthage release).

    It’s partly an issue due to how the dependencies are set up within Firebase – Protobuf is required by Messaging and RemoteConfig but not Analytics – so including it in Analytics brings unnecessary bloat for those who aren’t using Messaging or RemoteConfig (for example).

    That being said, I do recognize this is still a problem that we should try to fix 🙂 we’ll look at how we can work with this in our tooling and instructions, since we’d need to communicate this with users who are depending on it being included in their project at the moment.

    Thanks again for the report!