{"record":{"id":"b0b1cc281934ac53","repo":"gitbutlerapp/gitbutler","slug":"automatic-cli-installation-is-not-supported-on-win","errorCode":null,"errorMessage":"Automatic CLI installation is not supported on Windows.\n\nTo use the But CLI, you have two options:\n\n1. Copy the executable to a directory in your PATH:\ncopy \"{}\" \"%LOCALAPPDATA%\\Microsoft\\WindowsApps\\{}\"\n\n2. Add the current location to your PATH environment variable:\n- Press the Win key and select 'System'\n- Type 'Environment' into the search box and select 'edit variables for your account'\n- Under 'User variables', select 'Path' and click 'Edit'\n- Click 'New' and add: {}\n\nAfter either option, restart your terminal to use the 'but' command.","messagePattern":"Automatic CLI installation is not supported on Windows\\.\n\nTo use the But CLI, you have two options:\n\n1\\. Copy the executable to a directory in your PATH:\ncopy \"\\{\\}\" \"%LOCALAPPDATA%\\\\Microsoft\\\\WindowsApps\\\\\\{\\}\"\n\n2\\. Add the current location to your PATH environment variable:\n- Press the Win key and select 'System'\n- Type 'Environment' into the search box and select 'edit variables for your account'\n- Under 'User variables', select 'Path' and click 'Edit'\n- Click 'New' and add: \\{\\}\n\nAfter either option, restart your terminal to use the 'but' command\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"crates/but-action/src/cli.rs","lineNumber":132,"sourceCode":"        return Ok(());\n    }\n    bail!(\"Run `CARGO_TARGET_DIR=$PWD/target/tauri cargo build -p but` to build the `but` binary\")\n}\n\n/// On Windows, we'll provide helpful instructions rather than attempt automatic installation\n/// since:\n/// 1. Creating symlinks requires developer mode or admin privileges\n/// 2. There's no standard user-writable directory that's always in PATH\n/// 3. Users typically add directories to PATH manually on Windows\n///\n/// Note that this isn't usually called on Windows.\n#[cfg(windows)]\nfn install_cli_windows(cli_path: std::path::PathBuf) -> anyhow::Result<()> {\n    let but_filename = cli_path\n        .file_name()\n        .context(\"BUG: encountered but CLI path without /\")?;\n\n    bail!(\n        \"Automatic CLI installation is not supported on Windows.\\n\\\n        \\n\\\n        To use the But CLI, you have two options:\\n\\\n        \\n\\\n        1. Copy the executable to a directory in your PATH:\\n\\\n           copy \\\"{}\\\" \\\"%LOCALAPPDATA%\\\\Microsoft\\\\WindowsApps\\\\{}\\\"\\n\\\n        \\n\\\n        2. Add the current location to your PATH environment variable:\\n\\\n           - Press the Win key and select 'System'\\n\\\n           - Type 'Environment' into the search box and select 'edit variables for your account'\\n\\\n           - Under 'User variables', select 'Path' and click 'Edit'\\n\\\n           - Click 'New' and add: {}\\n\\\n        \\n\\\n        After either option, restart your terminal to use the 'but' command.\",\n        cli_path.display(),\n        but_filename.display(),\n        cli_path\n            .parent()","sourceCodeStart":114,"sourceCodeEnd":150,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/caf1f223d3cfb94488c9198ad34487c6006c648f/crates/but-action/src/cli.rs#L114-L150","documentation":"On Windows, install_cli_windows never installs automatically: symlinks require developer mode or admin rights and there is no guaranteed user-writable PATH directory. It bails with a message giving two manual options - copy the exe into %LOCALAPPDATA%\\Microsoft\\WindowsApps, or add the binary's directory to the user PATH - and reminds the user to restart the terminal (crates/but-action/src/cli.rs:132).","triggerScenarios":"Calling do_install_cli on Windows (note the code remarks this is unusual - the UI normally shows the instructions directly); a build where the cfg(windows) routing reaches install_cli_windows.","commonSituations":"Windows users clicking 'install CLI'; automated flows calling the install action on a Windows host.","solutions":["Option 1: copy the exe - `copy \"<cli_path>\" \"%LOCALAPPDATA%\\Microsoft\\WindowsApps\\but.exe\"` in cmd (mkdir the folder if missing)","Option 2: add the binary's directory to the user Path variable via 'Edit environment variables for your account', new entry pointing at the folder containing but.exe","Restart the terminal and verify with `but --version`"],"exampleFix":":: before: invoking install on Windows -> bail with instructions\n:: after: manual copy, then verify\ncmd> copy \"C:\\path\\to\\target\\tauri\\but.exe\" \"%LOCALAPPDATA%\\Microsoft\\WindowsApps\\but.exe\ncmd> but --version","handlingStrategy":"fallback","validationCode":"// Route around automatic install on Windows before it bails\n#[cfg(windows)]\n{\n    show_manual_windows_instructions(&cli_path); // copy-to-WindowsApps or PATH guidance\n    return Ok(());\n}\n#[cfg(not(windows))]\ndo_install_cli(mode)?;","typeGuard":null,"tryCatchPattern":null,"preventionTips":["On Windows, copy the exe to %LOCALAPPDATA%\\Microsoft\\WindowsApps or add its folder to user PATH, then restart the terminal","Enable Windows developer mode if symlink-based flows are ever attempted","Verify with `but --version` after the manual step instead of re-running the installer"],"tags":["rust","windows","cli","install","unsupported-platform","but-action"],"backgroundTag":"unsupported-platform","analyzedSha":"caf1f223d3cfb94488c9198ad34487c6006c648f","analyzedAt":"2026-08-20T07:55:40.983Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}