Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Flutter and app store releases

The linker warns that a search path directory was not found

Errorld: warning: directory not found for option '-L/Users/me/Project/build/Release-iphoneos'

Short answer

The linker was told to search a folder that no longer exists. A -L option comes from Library Search Paths or Other Linker Flags, a -F option from Framework Search Paths. Find the exact path in the warning, locate the setting that holds it in every target, and remove or correct that entry.

  • Applies to Xcode 26, CocoaPods, Swift Package Manager
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Print the search path settings for the target and look for the path from the warning.

    xcodebuild -showBuildSettings -project MyApp.xcodeproj -scheme MyApp | grep "SEARCH_PATHS\|OTHER_LDFLAGS"
  2. 2Match what you see, then jump to its fix

    1. 1The warning says option '-L/some/path'A stale entry in Library Search Paths (-L)Fix
    2. 2The warning says option '-F/some/path'A stale entry in Framework Search Paths (-F)Fix
    3. 3The path in the warning stops at the first spaceA path with spaces that is not quotedFix
    4. 4The path is not in any search path setting, yet the warning remainsThe -L flag is hard-coded in Other Linker FlagsFix

What does the error look like?

  • ld: warning: directory not found for option '-L/Users/me/Project/build/Release-iphoneos'
  • ld: warning: directory not found for option '-F/Users/me/Project/Frameworks'

Cause 1 of 4

A stale entry in Library Search Paths (-L)

1Check

Library Search Paths is the list of folders the linker searches for libraries. A project moved to another machine or a deleted build folder leaves old absolute paths behind.

xcodebuild -showBuildSettings -project MyApp.xcodeproj -scheme MyApp | grep "LIBRARY_SEARCH_PATHS"

2Fix

In the target's Build Settings, open Library Search Paths and delete or correct the entry. The value can come from the target, the project or a build configuration file: select the Levels filter in Build Settings to see which level holds it, and delete it there.

# Build Settings > Search Paths > Library Search Paths: remove the stale line

3Verify

Build again and confirm the warning no longer appears.

xcodebuild -project MyApp.xcodeproj -scheme MyApp build 2>&1 | grep "directory not found"

Confirmed by developer.apple.com

Did this fix it?

Cause 2 of 4

A stale entry in Framework Search Paths (-F)

1Check

Framework Search Paths lists folders searched for frameworks, by the compiler and by the linker. A folder of vendor frameworks that you moved or deleted shows up here.

xcodebuild -showBuildSettings -project MyApp.xcodeproj -scheme MyApp | grep "FRAMEWORK_SEARCH_PATHS"

2Fix

Remove the dead path or point it at the folder where the frameworks now live. Prefer a path relative to the project over an absolute path from one machine.

FRAMEWORK_SEARCH_PATHS = $(inherited) /path/to/Frameworks

3Verify

The build log is free of the warning.

xcodebuild -project MyApp.xcodeproj -scheme MyApp build 2>&1 | grep "directory not found"

Confirmed by developer.apple.com

Did this fix it?

Cause 3 of 4

A path with spaces that is not quoted

1Check

Paths in these settings are separated by whitespace, so a path with a space must be quoted. Without quotes, the linker sees two broken paths.

xcodebuild -showBuildSettings -project MyApp.xcodeproj -scheme MyApp | grep "SEARCH_PATHS"

2Fix

Quote each path that contains spaces.

LIBRARY_SEARCH_PATHS = $(inherited) "/path/with space/Libraries"

3Verify

Build again; the truncated paths no longer appear in the warning.

xcodebuild -project MyApp.xcodeproj -scheme MyApp build 2>&1 | grep "directory not found"

Confirmed by developer.apple.com

Did this fix it?

Cause 4 of 4

The -L flag is hard-coded in Other Linker Flags

1Check

Options in Other Linker Flags are passed straight to the linker, so a -L entry there produces the same warning.

xcodebuild -showBuildSettings -project MyApp.xcodeproj -scheme MyApp | grep "OTHER_LDFLAGS"

2Fix

Delete the dead -L option from Other Linker Flags, or replace it with the correct path.

OTHER_LDFLAGS = $(inherited) -lz

3Verify

The warning is gone after a clean build.

xcodebuild -project MyApp.xcodeproj -scheme MyApp clean build 2>&1 | grep "directory not found"

Confirmed by developer.apple.com

Did this fix it?

How do I stop it coming back?

  • Use project-relative paths, not absolute paths from one machine.
  • Delete search path entries when you remove a library or framework from a project.
  • Check every target (app, tests, extensions) when you clean up build settings.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.