path attribute instead of name, causing a duplicated ‘Pods/Pods’ path. Fix it by running pod deintegrate then pod install, then editing .xcodeproj/project.pbxproj to change path = Pods to name = Pods in the PBXGroup section.Why this happens
When CocoaPods integrates with your Xcode project, it creates a Pods group in the project navigator that references the Pods directory containing generated .xcconfig files. In some Xcode and CocoaPods version combinations, the project file (.xcodeproj/project.pbxproj) stores this reference using a path attribute instead of a name attribute.
The path attribute tells Xcode to resolve the group relative to the project file’s location. Since the Pods directory already sits inside your project root, Xcode appends the path again, producing a doubled Pods/Pods/ segment. When the build system looks for Pods/Pods/Target Support Files/Pods-ProjectName/Pods-ProjectName.debug.xcconfig, the file doesn’t exist at that location — it’s actually at Pods/Target Support Files/Pods-ProjectName/Pods-ProjectName.debug.xcconfig.
This mismatch typically appears after upgrading Xcode, switching CocoaPods versions, or when the project file gets corrupted during a merge. The error message ProjectName.debug.xcconfig unable to open file with a duplicated Pods directory in the path is the telltale sign.
How to fix it
1. Deintegrate and reinstall pods, then fix the project reference (most reliable)
This approach cleans the CocoaPods integration completely and corrects the PBXGroup reference in the project file.
- Close Xcode completely.
- Open Terminal in your project root directory.
- Run the deintegration and reinstall commands:
bash
pod deintegrate
pod install - Open the generated
.xcworkspacefile in Xcode. - Before building, fix the project file reference:
– In Finder, right-click your.xcodeprojfile and choose Show Package Contents.
– Openproject.pbxprojin a text editor (VS Code, BBEdit, or Xcode itself).
– Search for the PBXGroup entry that represents the Pods group. It looks similar to:
/* Begin PBXGroup section */
1234567890ABCDEF /* Pods */ = {
isa = PBXGroup;
children = (
);
path = Pods;
sourceTree = "<group>";
};
– Changepath = Pods;toname = Pods;:
1234567890ABCDEF /* Pods */ = {
isa = PBXGroup;
children = (
);
name = Pods;
sourceTree = "<group>";
};
– Save the file. - In Xcode, choose Product → Clean Build Folder (⇧⌘K).
- Build the project (⌘B). The error should be gone.
Why this works:
pod deintegrateremoves all CocoaPods references from the Xcode project.pod installrecreates them fresh. The manualproject.pbxprojedit ensures the Pods group uses anameattribute (a logical group name) instead of apathattribute (a filesystem path), preventing Xcode from doubling the directory segment.
2. Quick fix: Reinstall pods and clean build folder
If you’re in a hurry and the project file hasn’t been corrupted beyond the path attribute, this lighter procedure often works.
- Close Xcode.
- In Terminal, run:
bash
pod install - Open the
.xcworkspacein Xcode. - Choose Product → Clean Build Folder (⇧⌘K).
- Build the project.
This works when the PBXGroup already uses name = Pods but the build cache or derived data held a stale path. If the error persists, fall back to Fix 1.
3. Verify the generated xcconfig file exists
Occasionally the error appears because the .xcconfig file genuinely isn’t generated.
- In Terminal, check the expected location:
bash
ls -la Pods/Target\ Support\ Files/Pods-YourProjectName/Pods-YourProjectName.debug.xcconfig - If the file is missing, run
pod install --repo-updateto force a full pod update and regeneration. - If it exists but Xcode still complains, the path duplication is the culprit — use Fix 1.
How to prevent it
- Commit the corrected
project.pbxprojafter applying Fix 1 so thename = Podschange persists across team members and CI. - Avoid editing the Pods group in Xcode’s project navigator (renaming, moving, or changing its location). Let CocoaPods manage it.
- Use the same CocoaPods version across the team by pinning it in a
Gemfile(gem 'cocoapods', '1.15.2') and runningbundle exec pod install. - Don’t check in
Pods/directory — add it to.gitignore. Only commit thePodfile,Podfile.lock, and the corrected.xcodeproj. - Run
pod deintegratebefore major Xcode upgrades (e.g., Xcode 15 → 16) to avoid stale references.
FAQ
Why does the error show Pods/Pods/ in the path?
The PBXGroup for the Pods folder uses a path attribute. Xcode resolves that path relative to the project file, which already sits beside the Pods directory, so it appends Pods a second time.
Can I fix this without editing project.pbxproj manually?
Not reliably. The path vs name attribute is stored in the project file and isn’t exposed in Xcode’s UI. A manual edit (or a scripted sed replacement in CI) is the standard workaround.
Will pod install alone fix it next time?
Only if the PBXGroup already has name = Pods. If the project file still contains path = Pods, pod install will preserve that attribute and the error returns. The manual edit is required once per project (or after each pod deintegrate).
Related errors
Pods-ProjectName.release.xcconfig unable to open file— same root cause, release configuration.Could not find included file 'Pods/Target Support Files/Pods-ProjectName/Pods-ProjectName.debug.xcconfig'— variant when the build system reports the missing include.
Both resolve with the same steps above.
Parts of this guide are adapted from content licensed under CC BY-SA 4.0; this article is shared under the same license.
