warn Multiple Podfiles were found: ios/Podfile,vendor/bundle/ruby/2.7.0/gems/cocoapods-core-1.11.3/lib/cocoapods-core/Podfile. Choosing ios/Podfile automatically.

Warn Multiple Podfiles were found

As a developer, you might encounter a warning message that reads "Multiple Podfiles were found: ios/Podfile,vendor/bundle/ruby/2.7.0/gems/cocoapods-core-1.11.3/lib/cocoapods-core/Podfile. Choosing ios/Podfile automatically." This message indicates that the CocoaPods tool found multiple Podfiles in your project and had to choose one of them automatically.

What is a Podfile?

A Podfile is a specification that lists the dependencies of an iOS project. It is used by CocoaPods to manage the installation and updates of third-party libraries in your project. When you run the "pod install" command, CocoaPods reads the Podfile and installs the specified dependencies.

Why would there be multiple Podfiles?

It is not common to have multiple Podfiles in an iOS project, but it can happen if you have a complex project structure or if you are using different tools that generate Podfiles. For example, a vendor might provide a Podfile for their SDK, or you might have different targets in your project that require different dependencies.

How to resolve the warning?

If you encounter this warning, CocoaPods will choose one of the Podfiles automatically, but it might not be the one you want. To resolve the warning and make sure that the right dependencies are installed, you can specify the path to the Podfile you want to use by adding the "--project-directory" flag to the "pod install" command:


pod install --project-directory=path/to/ios

This command tells CocoaPods to use the Podfile located in the "ios" directory, which is the one that you want to use. You can replace "path/to/ios" with the actual path to your Podfile.

If you have multiple targets in your project, you might need to specify the Podfile for each target separately. In that case, you can use the "--project-directory" flag followed by the path to the directory that contains the Podfile for each target:


pod install --project-directory=path/to/ios/Target1
pod install --project-directory=path/to/ios/Target2

By specifying the correct Podfile for each target, you ensure that the right dependencies are installed, and you avoid any conflicts or errors in your project.

Subscribe to The Poor Coder | Algorithm Solutions

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.
[email protected]
Subscribe