-L (libraries) or -F (frameworks) flag. Open your Target’s Build Settings, search for ‘Library Search Paths’ (for -L) or ‘Framework Search Paths’ (for -F), and remove the invalid or empty directory entries.Why this happens
During compilation, Xcode invokes the Apple linker (ld) and provides flags instructing it where to locate precompiled binaries and dependencies. When you see the warning ld: warning: directory not found for option '-L...' or ld: warning: directory not found for option '-F...', the linker was told to check a directory that no longer exists on disk.
The flag prefix indicates the specific build setting responsible for the path:
-Lspecifies a Library Search Path (LIBRARY_SEARCH_PATHS). The linker is looking for static libraries (.a) or dynamic libraries (.dylib).-Fspecifies a Framework Search Path (FRAMEWORK_SEARCH_PATHS). The linker is looking for compiled Apple frameworks (.frameworkor.xcframework).-I(less common at link time, but appears during compilation) specifies a Header Search Path (HEADER_SEARCH_PATHS).
This issue typically appears after deleting a third-party SDK, moving project files to a new directory, checking out a repository on another developer’s machine, or modifying CocoaPods / Carthage configurations. Xcode automatically adds search paths when you drag binaries into a project, but it does not automatically delete those paths when you remove the files.
How to fix it
1. Delete stale entries from Build Settings
Inspect your build settings to find and remove the path printed in the warning.
- In Xcode’s Project Navigator (left sidebar), select the blue project file at the top.
- In the main pane, select your target under Targets.
- Click on the Build Settings tab and make sure All and Combined (or Levels) are selected.
- In the filter search bar in the top-right corner, search for the setting indicated by the flag:
* Search forLibrary Search Pathsif your warning begins with-L.
* Search forFramework Search Pathsif your warning begins with-F. - Double-click the value field next to the setting to open the path pop-up list.
- Select the invalid path (often highlighted or referencing a deleted folder such as
Downloadsor an old SDK) and click the minus (-) button to remove it. - Check for empty rows. A blank row will resolve to an invalid directory flag. Select any empty lines and press delete.
- Repeat this check under Project (above Targets) to verify the path wasn’t defined at the project level.
2. Clean the build folder
After modifying search paths, clear any cached build products so the linker runs fresh.
- Go to the menu bar and choose Product > Clean Build Folder (or press
Cmd + Shift + K). - Rebuild your project (
Cmd + B). - Check the Report Navigator (the speech-bubble tab in the left sidebar) to confirm the warning is gone.
3. Check configuration files (.xcconfig)
If the build setting field is populated from an external configuration file (such as one generated by CocoaPods), the path will not be editable directly through the Xcode UI.
- In the Project Navigator, check for
.xcconfigfiles linked to your project. - Search your project for the missing path using the Find navigator (
Cmd + Shift + F). - If CocoaPods manages the settings, run the following in your terminal:
pod deintegrate
pod install
This removes stale CocoaPods paths and regenerates clean .xcconfig files based on your current Podfile.
4. Remove ghost entries directly from project.pbxproj
Sometimes an empty string or malformed quote remains in Xcode’s internal project file without showing up clearly in the GUI.
- Close Xcode completely.
- Right-click your
.xcodeprojbundle in Finder and select Show Package Contents. - Open
project.pbxprojin a text editor (such as TextEdit or VS Code). - Search for
LIBRARY_SEARCH_PATHSorFRAMEWORK_SEARCH_PATHS. - Look for lines matching the path cited in your build log, or lines containing
""(empty string entries). - Delete those lines, save the file, and reopen your project in Xcode.
How to prevent it
- Clean search paths when deleting dependencies: When manually removing a framework or
.afile from your project, immediately visit Build Settings to delete its corresponding search path. - Use Swift Package Manager: Swift Package Manager handles dependencies and search paths automatically without adding hardcoded absolute paths to your project file.
- Avoid absolute user paths: Never leave paths containing
/Users/username/...or/Downloads/...in your project settings. Always use build variables like$(PROJECT_DIR)or$(SRCROOT)with recursive lookups disabled if local files are required.
FAQ
Does this warning break app distribution or cause App Store rejection?
No. The warning alone will not prevent your app from passing validation or uploading to App Store Connect. However, it indicates a misconfigured build setup that can mask missing dependency errors or slow down build times.
What is the difference between the -L and -F linker flags?
The -L flag tells the linker which directories to search for raw static libraries (.a) or dynamic libraries (.dylib). The -F flag tells the linker which directories to search for packaged Apple frameworks (.framework or .xcframework).
Why does the warning persist after I deleted the path in Build Settings?
Check both the Target and Project levels in Build Settings, as well as any active .xcconfig files. If any level defines the path, Xcode will still pass it to the linker. Remember to perform a Clean Build Folder (Cmd + Shift + K) after making adjustments.
Parts of this guide are adapted from content licensed under CC BY-SA 3.0; this article is shared under the same license.
