{"record":{"id":"ecd8601eced0075e","repo":"rustdesk/rustdesk","slug":"daemon-plist-not-found-in-embedded-resources","errorCode":null,"errorMessage":"daemon.plist not found in embedded resources","messagePattern":"daemon\\.plist not found in embedded resources","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"src/platform/macos.rs","lineNumber":347,"sourceCode":"        Ok::<(), std::io::Error>(())\n    })();\n    if result.is_err() {\n        let _ = std::fs::remove_file(&temporary);\n    }\n    result.map_err(Into::into)\n}\n\npub fn write_plists() -> ResultType<()> {\n    let daemon_plist_path = format!(\n        \"/Library/LaunchDaemons/com.carriez.{}_service.plist\",\n        crate::get_app_name()\n    );\n    let agent_plist_path = format!(\n        \"/Library/LaunchAgents/com.carriez.{}_server.plist\",\n        crate::get_app_name()\n    );\n    let Some(daemon_plist) = PRIVILEGES_SCRIPTS_DIR.get_file(\"daemon.plist\") else {\n        bail!(\"daemon.plist not found in embedded resources\");\n    };\n    let Some(daemon_plist_body) = daemon_plist.contents_utf8().map(correct_app_name) else {\n        bail!(\"Failed to read daemon.plist\");\n    };\n    let Some(agent_plist) = PRIVILEGES_SCRIPTS_DIR.get_file(\"agent.plist\") else {\n        bail!(\"agent.plist not found in embedded resources\");\n    };\n    let Some(agent_plist_body) = agent_plist.contents_utf8().map(correct_app_name) else {\n        bail!(\"Failed to read agent.plist\");\n    };\n    write_plist_atomically(&daemon_plist_path, &daemon_plist_body)?;\n    write_plist_atomically(&agent_plist_path, &agent_plist_body)?;\n    log::info!(\"[write-plists] Wrote daemon and agent plists\");\n    Ok(())\n}\n\npub fn uninstall_service(show_new_window: bool, sync: bool) -> bool {\n    // to-do: do together with win/linux about refactory start/stop service","sourceCodeStart":329,"sourceCodeEnd":365,"githubUrl":"https://github.com/rustdesk/rustdesk/blob/91c9fccbb0f7bfe5f11644d5fbdec9b23fa10540/src/platform/macos.rs#L329-L365","documentation":"macOS service installation embeds daemon/agent launchd plists via `rust-embed` in `PRIVILEGES_SCRIPTS_DIR`. Before installing, the code fetches `daemon.plist` from the embedded bundle; if the asset is absent it bails with `daemon.plist not found in embedded resources`, meaning the binary was built without the required embedded resources.","triggerScenarios":"Calling the macOS install/uninstall service flow on a binary where `PRIVILEGES_SCRIPTS_DIR.get_file(\"daemon.plist\")` returns None — plist not present in the embedded directory at compile time, wrong `#[folder]` path, or a repackaged/stripped binary.","commonSituations":"Custom builds where `res/macOS/launchd` (or equivalent) files were deleted or renamed; building with a feature set that excludes the embedded dir; packaging scripts that rebuild the binary without re-embedding resources; app name mismatch after `correct_app_name` handling.","solutions":["Rebuild the app from a clean checkout so rust-embed picks up `daemon.plist` from the embedded folder.","Verify the plist exists in the folder referenced by the `PRIVILEGES_SCRIPTS_DIR` `#[folder = ...]` attribute.","Ensure your build/packaging pipeline doesn't strip or exclude resource files from the binary.","Use official release binaries if you're running a locally patched build."],"exampleFix":"// verify before install\nif PRIVILEGES_SCRIPTS_DIR.get_file(\"daemon.plist\").is_none() {\n    return Err(\"build is missing embedded daemon.plist; rebuild required\".into());\n}\ninstall_daemon()?;","handlingStrategy":"validation","validationCode":"// at startup, before offering install/uninstall\nif PRIVILEGES_SCRIPTS_DIR.get_file(\"daemon.plist\").is_none()\n    || PRIVILEGES_SCRIPTS_DIR.get_file(\"agent.plist\").is_none() {\n    log::error!(\"embedded launchd plists missing; rebuild with resources\");\n}","typeGuard":null,"tryCatchPattern":"match install_me() {\n    Err(e) if e.to_string().contains(\"daemon.plist not found\") => {\n        eprintln!(\"broken build: embedded daemon.plist missing; reinstall official app\");\n    }\n    r => r?,\n}","preventionTips":["Verify rust-embed folder contents in CI before publishing macOS builds.","Never strip resource files from the shipped binary.","Add a startup self-check that the embedded plists are present.","Distribute official builds; avoid hand-patched repackaging."],"tags":["macos","launchd","embedded-resources","service-install"],"backgroundTag":"file-not-found","analyzedSha":"91c9fccbb0f7bfe5f11644d5fbdec9b23fa10540","analyzedAt":"2026-09-10T19:53:44.083Z","contentChangedAt":"2026-09-10T19:53:44.083Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}