{"record":{"id":"a8777a40922231ad","repo":"gitbutlerapp/gitbutler","slug":"automatic-cli-installation-is-only-supported-on-macos-see","errorCode":null,"errorMessage":"Automatic CLI installation is only supported on macOS. See Settings for manual installation instructions.","messagePattern":"Automatic CLI installation is only supported on macOS\\. See Settings for manual installation instructions\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but-api/src/legacy/cli.rs","lineNumber":25,"sourceCode":"use but_api_macros::but_api;\nuse tracing::instrument;\n\n#[cfg(feature = \"export-schema\")]\nbut_schemars::register_sdk_type!(ExistingSymlinkPolicy);\n\n#[but_api]\n#[instrument(err(Debug))]\npub fn install_cli() -> Result<()> {\n    #[cfg(target_os = \"macos\")]\n    {\n        but_action::cli::do_install_cli_v2(\n            &get_cli_path()?,\n            InstallMode::AllowPrivilegeElevation,\n            ExistingSymlinkPolicy::Replace,\n        )\n    }\n    #[cfg(not(target_os = \"macos\"))]\n    anyhow::bail!(\n        \"Automatic CLI installation is only supported on macOS. See Settings for manual installation instructions.\"\n    )\n}\n\n/// Install the bundled macOS CLI. Trusted hosts supply the source path, not renderers.\n/// Returns false when administrator authorization is cancelled.\n#[but_api(napi)]\n#[instrument(err(Debug))]\npub fn install_cli_v2(cli_path: String, symlink_policy: ExistingSymlinkPolicy) -> Result<bool> {\n    #[cfg(target_os = \"macos\")]\n    {\n        match but_action::cli::do_install_cli_v2(\n            std::path::Path::new(&cli_path),\n            InstallMode::AllowPrivilegeElevation,\n            symlink_policy,\n        ) {\n            Ok(()) => Ok(true),\n            Err(err)","sourceCodeStart":7,"sourceCodeEnd":43,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but-api/src/legacy/cli.rs#L7-L43","documentation":"The install_cli API only implements automatic CLI symlink installation on macOS (where it can use privileged helper / trusted hosts). On any other platform it immediately bails with this message, directing users to manual installation via the app Settings.","triggerScenarios":"Calling install_cli() on Windows, Linux, or any non-macOS target (the #[cfg(not(target_os = \"macos\"))] branch).","commonSituations":"User clicks 'Install CLI' in the desktop app on Linux/Windows; automated tests exercising the install endpoint on non-macOS CI runners.","solutions":["Use manual installation: follow the CLI setup instructions in the app Settings","Only expose/call the automatic install action on macOS builds","Feature-gate the install UI by target OS"],"exampleFix":"// before\nawait installCli();\n// after\nif (platform === 'darwin') {\n  await installCli();\n} else {\n  openSettingsCliInstructions();\n}","handlingStrategy":"validation","validationCode":"if (navigator.platform !== 'MacIntel' && !navigator.userAgent.includes('Mac')) {\n  showManualInstallInstructions();\n} else {\n  await installCli();\n}","typeGuard":null,"tryCatchPattern":"try {\n  await installCli();\n} catch (e) {\n  if (String(e).includes('only supported on macOS')) {\n    openSettingsCliInstructions();\n  } else throw e;\n}","preventionTips":["Feature-gate automatic CLI install behind an OS check","Always provide a manual-install path in Settings","Test install flows on all supported platforms"],"tags":["rust","cli","platform"],"backgroundTag":"unsupported-platform","analyzedSha":"58e5313667b857ef39a730e380af31816a7b1768","analyzedAt":"2026-09-18T06:50:32.052Z","contentChangedAt":"2026-09-18T06:50:32.052Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}