BigPizzaV3/CodexPlusPlus · error
macOS bundle is missing its binary source
Error message
macOS bundle is missing its binary source
What it means
write_bundle assembles a macOS .app bundle by copying the compiled binary into Contents/MacOS and then writing a launch script next to it. If the bundle definition has no binary source (no source path resolved for the executable), there is nothing to copy, so it bails rather than producing a broken bundle.
Solutions
- Build the release binary before running the installer
- Verify the configured binary source path exists and pass it into the bundle definition
- Check how MacosAppBundle is constructed — ensure the binary source field is populated
Example fix
// before
let bundle = MacosAppBundle { info_plist, launch_script, ..Default::default() }; // no binary source
// after
assert!(binary_source.exists(), "build the binary first");
let bundle = MacosAppBundle { binary_source, info_plist, launch_script }; Defensive patterns
Strategy: validation
Validate before calling
if !bundle.binary_source.exists() { return Err(anyhow!("binary not built at {:?}", bundle.binary_source)); } Type guard
fn has_binary_source(bundle: &MacosAppBundle) -> bool { bundle.binary_source.as_ref().map(|p| p.exists()).unwrap_or(false) } Try / catch
match install_app_bundles(&opts) { Err(e) if e.to_string().contains("missing its binary source") => eprintln!("run the build step first"), ... } Prevention
- Always build (cargo build --release) before installing bundles
- Validate binary_source.exists() before constructing the bundle
- In CI, make the build step an explicit prerequisite of the install step
When it happens
Trigger: install_app_bundles → write_bundle called with a MacosAppBundle whose binary source is absent: the binary was not built before install, the source path in InstallOptions points to a nonexistent file, or the bundle struct was constructed without setting the binary source field.
Common situations: Running 'install' before 'cargo build --release'; renaming or moving the target/ binary so the recorded path no longer resolves; hand-constructing MacosAppBundle in tests without the binary field.
Understand the failure class
Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.
Related errors
- macOS bundle binary is unavailable at
- 打开 DMG 失败:
- 启动系统浏览器失败:
- macOS app bundles are only supported on macOS
- macOS app did not exit before debug relaunch
AI-assisted analysis of BigPizzaV3/CodexPlusPlus@b1ed92e5e4 (2026-09-19).
Data as JSON: /api/errors/b7ff9752a641e21f.
Report an issue: GitHub.
Appendix: source
Thrown at crates/codex-plus-core/src/install/macos.rs:127
fn write_bundle(bundle: &MacosAppBundle) -> anyhow::Result<()> {
let contents = bundle.app_path.join("Contents");
let macos = contents.join("MacOS");
let resources = contents.join("Resources");
fs::create_dir_all(&macos)?;
fs::create_dir_all(&resources)?;
fs::write(contents.join("Info.plist"), &bundle.info_plist)?;
if let (Some(source), Some(target_name)) = (&bundle.binary_source, &bundle.binary_target_name) {
validate_binary_source(source)?;
let target = macos.join(target_name);
if source != &target {
fs::copy(source, &target)?;
}
validate_binary_source(&target)?;
let mut permissions = fs::metadata(&target)?.permissions();
permissions.set_mode(0o755);
fs::set_permissions(target, permissions)?;
} else {
anyhow::bail!("macOS bundle is missing its binary source");
}
let executable = macos.join(executable_name_from_plist(&bundle.info_plist));
fs::write(&executable, &bundle.launch_script)?;
let mut permissions = fs::metadata(&executable)?.permissions();
permissions.set_mode(0o755);
fs::set_permissions(executable, permissions)?;
copy_icon(&resources)?;
Ok(())
}
#[cfg(target_os = "macos")]
fn validate_binary_source(path: &Path) -> anyhow::Result<()> {
let metadata = fs::metadata(path).map_err(|error| {
anyhow::anyhow!(
"macOS bundle binary is unavailable at {}: {error}",
path.display()
)
})?;View on GitHub (pinned to b1ed92e5e4)