BigPizzaV3/CodexPlusPlus · error

macOS app bundles are only supported on macOS

Error message

macOS app bundles are only supported on macOS

What it means

install_app_bundles creates macOS .app bundles. On non-macOS builds the crate compiles a stub version (#[cfg(not(target_os = "macos"))]) that unconditionally fails, because .app bundles and their Info.plist/launch-script layout only exist on macOS. This is a compile-time platform gate, not a runtime misconfiguration.

Solutions

  1. Only call install_app_bundles when cfg!(target_os = "macos")
  2. Use the platform-appropriate install path for the current OS (e.g. Linux desktop entries / Windows shortcuts)
  3. Skip bundle installation with a graceful message on non-macOS hosts

Example fix

// before
install_app_bundles(&options)?; // crashes on Linux
// after
if cfg!(target_os = "macos") {
    install_app_bundles(&options)?;
} else {
    println!("app bundles are macOS-only; skipped");
}
Defensive patterns

Strategy: fallback

Validate before calling

let supported = cfg!(target_os = "macos");

Type guard

fn supports_app_bundles() -> bool { cfg!(target_os = "macos") }

Try / catch

match install_app_bundles(&opts) { Err(e) if e.to_string().contains("only supported on macOS") => skip_bundle_install(), Err(e) => return Err(e), Ok(()) => {} }

Prevention

When it happens

Trigger: Calling install_app_bundles from any non-macOS target (Linux, Windows) — the cfg stub is what gets compiled and it always bails.

Common situations: Running the installer on a Linux CI box; cross-platform code paths calling macOS bundle installation without an OS check; developers testing installer logic locally on Windows/Linux.

Understand the failure class

Background: "unsupported platform" / "not supported on this platform" errors: what they mean and how to fix them — this error's family across 47 libraries.

Related errors


AI-assisted analysis of BigPizzaV3/CodexPlusPlus@b1ed92e5e4 (2026-09-19). Data as JSON: /api/errors/60c34f62813fa469. Report an issue: GitHub.

Appendix: source

Thrown at crates/codex-plus-core/src/install/macos.rs:100

    write_bundle(&build_app_bundle(options, true))?;
    Ok(())
}

#[cfg(target_os = "macos")]
pub fn uninstall_app_bundles(options: &InstallOptions) -> anyhow::Result<()> {
    let install_root = install_root_or_default(options);
    for name in [SILENT_NAME, MANAGER_NAME] {
        let app = install_root.join(format!("{name}.app"));
        if app.exists() {
            fs::remove_dir_all(app)?;
        }
    }
    Ok(())
}

#[cfg(not(target_os = "macos"))]
pub fn install_app_bundles(_options: &InstallOptions) -> anyhow::Result<()> {
    anyhow::bail!("macOS app bundles are only supported on macOS")
}

#[cfg(not(target_os = "macos"))]
pub fn uninstall_app_bundles(_options: &InstallOptions) -> anyhow::Result<()> {
    anyhow::bail!("macOS app bundles are only supported on macOS")
}

#[cfg(target_os = "macos")]
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);

View on GitHub (pinned to b1ed92e5e4)