Xcode - ld library not found for -lPods
Interview Questions practice on Codemia
Over 8,000 real interview questions from top companies, searchable by company and role.
Introduction
The Xcode error ld: library not found for -lPods means the linker was told to look for a CocoaPods-generated library, but that library is not where the build expects it to be. In practice, the fix is usually to correct the CocoaPods integration rather than to fight the linker directly.
Why This Error Happens
When CocoaPods integrates dependencies, it creates build settings, targets, and support files that Xcode uses during linking. If those generated pieces go out of sync with the project, Xcode may still try to link -lPods even though the expected artifact is missing.
Common reasons include:
- opening the
.xcodeprojinstead of the.xcworkspace - stale pod integration files
- broken build settings or search paths
- switching branches without reinstalling pods
- manual linker flags left behind from older CocoaPods setups
The error is a symptom of project integration drift.
First Check the Workspace
If the project uses CocoaPods, you should normally open the workspace:
not just:
Opening the project file directly is one of the fastest ways to get missing-linker errors because the pod targets are managed through the workspace integration.
Reinstall the Pods Cleanly
A common repair sequence is:
Then reopen the workspace and build again.
If the lockfile and workspace are already correct but local artifacts are stale, a lighter version may be enough:
If dependencies changed:
Use update only when you actually want newer pod versions. For integration repair, install is usually the safer first step.
Clean Build Artifacts
Stale Xcode artifacts can keep the linker looking in the wrong place. Clean the build folder in Xcode, or remove DerivedData if the integration still looks wrong.
Typical workflow:
- clean the build folder
- close Xcode
- rerun
pod install - reopen the workspace
This is often enough when the project files are correct but Xcode is holding on to old paths.
Inspect Build Settings If It Still Fails
If the error survives a reinstall, inspect:
- '
Library Search Paths' - '
Framework Search Paths' - '
Other Linker Flags'
The important question is whether the project still contains old manual -lPods references or paths that no longer correspond to the generated pods support files.
In modern CocoaPods setups, you generally should not hand-edit linker flags to force pod libraries in manually. If those flags exist from an older project configuration, they can become the source of the problem.
Watch for Branch and Team Workflow Issues
This error often appears after:
- pulling a branch with a changed
Podfile - deleting the
Podsdirectory locally - forgetting to commit the workspace or lockfile policy your team expects
That is why "it works on one machine but not another" is common here. The build depends on generated integration state, not just source files.
Common Pitfalls
- Opening the
.xcodeprojinstead of the.xcworkspace. - Running
pod updatewhen you only neededpod install. - Manually editing linker flags and leaving behind stale
-lPodsreferences. - Cleaning Xcode without regenerating the pod integration files when the real problem is CocoaPods state.
- Switching Git branches and forgetting that the pod setup may need to be reinstalled for that branch.
Summary
- '
ld: library not found for -lPodsusually means the CocoaPods integration is out of sync with the Xcode build.' - Open the workspace, not the raw project file.
- Reinstall pods with
pod install, and usepod deintegrateplus reinstall if the integration is badly broken. - Clean stale build artifacts and inspect linker-related build settings if needed.
- Treat the problem as an integration mismatch, not as a missing random library file.
Related reading
- Xcode - There are no dSYMs available for download
- Xcode 10.2.1 Command PhaseScriptExecution failed with a nonzero exit code
- Xcode 10.2 Failed to Run App on Simulator with iOS 10
- Xcode 10.2 Update issue Build system error -1 Unable to load contents of file list input/output xcfilelist
- Xcode 10 A valid provisioning profile for this executable was not found
- Xcode 10, Command CodeSign failed with a nonzero exit code
- Xcode 10 Error Multiple commands produce
- Xcode 10b5 - duplicate symbol linker error, can''t compile with Crashlytics
.png&w=3840&q=75)
Tackling System Design Interview Problems
A short course that equips you with the skills to approach system design interviews methodically.
Start the free courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
Interview Questions practice on Codemia
Over 8,000 real interview questions from top companies, searchable by company and role.