{"record":{"id":"f3a4be779ce5cf14","repo":"tauri-apps/tauri","slug":"library-not-found","errorCode":null,"errorMessage":"Library not found: {}","messagePattern":"Library not found: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tauri-build/src/lib.rs","lineNumber":184,"sourceCode":"}\n\n// Copies the macOS application bundle frameworks to the target folder\nfn copy_frameworks(dest_dir: &Path, frameworks: &[String]) -> Result<()> {\n  fs::create_dir_all(dest_dir)\n    .with_context(|| format!(\"Failed to create frameworks output directory at {dest_dir:?}\"))?;\n  for framework in frameworks.iter() {\n    if framework.ends_with(\".framework\") {\n      let src_path = Path::new(framework);\n      let src_name = src_path\n        .file_name()\n        .expect(\"Couldn't get framework filename\");\n      let dest_path = dest_dir.join(src_name);\n      copy_dir(src_path, &dest_path)?;\n      continue;\n    } else if framework.ends_with(\".dylib\") {\n      let src_path = Path::new(framework);\n      if !src_path.exists() {\n        return Err(anyhow::anyhow!(\"Library not found: {}\", framework));\n      }\n      let src_name = src_path.file_name().expect(\"Couldn't get library filename\");\n      let dest_path = dest_dir.join(src_name);\n      copy_file(src_path, &dest_path)?;\n      continue;\n    } else if framework.contains('/') {\n      return Err(anyhow::anyhow!(\n        \"Framework path should have .framework extension: {}\",\n        framework\n      ));\n    }\n    if let Some(home_dir) = dirs::home_dir() {\n      if copy_framework_from(&home_dir.join(\"Library/Frameworks/\"), framework, dest_dir)? {\n        continue;\n      }\n    }\n    if copy_framework_from(\"/Library/Frameworks/\".as_ref(), framework, dest_dir)?\n      || copy_framework_from(\"/Network/Library/Frameworks/\".as_ref(), framework, dest_dir)?","sourceCodeStart":166,"sourceCodeEnd":202,"githubUrl":"https://github.com/tauri-apps/tauri/blob/460ec35447493200d64290dd7f015d5a91d0fd58/crates/tauri-build/src/lib.rs#L166-L202","documentation":"When copying macOS frameworks, a `bundle.macOS.framework` entry ending in .dylib is treated as a direct library path; if that path does not exist on disk, copy_frameworks fails with 'Library not found'.","triggerScenarios":"`tauri.conf.json` `bundle.macOS.frameworks` contains a `*.dylib` path that is missing at build time (try_build -> copy_frameworks).","commonSituations":"Dylib built in a previous step that failed or was cleaned, wrong relative/absolute path, or building macOS bundle on CI where the native library wasn't compiled.","solutions":["Verify the dylib path in `bundle.macOS.frameworks` and correct it","Build/copy the dylib to that location before `tauri build`","If the library comes from another crate, add a build-order dependency or use cargo artifact dependencies"],"exampleFix":"// before\n\"frameworks\": [\"../target/libs/libfoo.dylib\"]  // never built\n// after\n\"frameworks\": [\"${PROJECT_DIR}/libs/libfoo.dylib\"]  // ensure file exists","handlingStrategy":"validation","validationCode":"for (const fw of cfg.bundle?.macOS?.frameworks ?? []) {\n  if (fw.endsWith('.dylib') && !fs.existsSync(fw)) throw new Error(`dylib missing: ${fw}`);\n}","typeGuard":"const dylibExists = (p: string): p is string => p.endsWith('.dylib') && fs.existsSync(p);","tryCatchPattern":"try {\n  await buildMac();\n} catch (e) {\n  if (String(e).includes('Library not found')) throw new Error(`Build or correct dylib path: ${e.message}`);\n  throw e;\n}","preventionTips":["Ensure the dylib build step runs before tauri build in CI","Use absolute or workspace-relative paths for dylibs","Clean-build locally to catch stale-path configs"],"tags":["macos","frameworks","dylib","tauri-build"],"backgroundTag":"file-not-found","analyzedSha":"460ec35447493200d64290dd7f015d5a91d0fd58","analyzedAt":"2026-09-18T23:55:51.277Z","contentChangedAt":"2026-09-18T23:55:51.277Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}