CLI Installation Guide
DocsCLI Guides & WorkflowCLI Installation Guide

CLI Installation Guide

Installing, updating, uninstalling, and configuring PATH for the KSP command-line interface.

Platform Availability

The KSP CLI (ksp.exe / ksp) is a standalone native binary compiled from Rust with zero runtime dependencies. It supports Windows (x64/ARM64), Linux (x64/ARM64), and macOS (Apple Silicon/Intel).

1. Installing the CLI

Choose the automated one-liner installer for your operating system or compile directly via Cargo if you already have the Rust toolchain installed.

Windows (PowerShell)Recommended for Windows 10/11
irm https://www.kspprotocol.dev/install.ps1 | iex
Linux & macOS (Terminal)Ubuntu, Debian, Arch, macOS
curl -fsSL https://www.kspprotocol.dev/install.sh | sh
Rust Cargo (from crates.io / Git)Requires Rust stable ≥ 1.80
cargo install ksp --locked

2. Updating

The CLI includes an intelligent self-updater that checks official GitHub releases, verifies SHA-256 cryptographic hashes, and updates the executable cleanly in-place without requiring administrative elevation.

# Check for available updates without installing
ksp update --check

# Perform self-update to the latest stable release
ksp update

3. Uninstalling

You can completely remove all KSP configuration directories, local certificates, and binaries using either the built-in subcommand or the official uninstaller script.

# Option A: Built-in uninstaller
ksp uninstall

# Option B: Windows 1-Liner script
irm https://www.kspprotocol.dev/uninstall.ps1 | iex

# Option C: Linux/macOS script
curl -fsSL https://www.kspprotocol.dev/uninstall.sh | sh
Note on Windows File Locks (Access Denied): If ksp.exe is running inside your terminal during uninstallation, Windows prevents the file from deleting itself (os error 5). When this occurs, KSP will interactively prompt to schedule an automated background cleanup task (cmd.exe timeout /t 2) that cleanly deletes the binary 2 seconds after you exit!

4. PATH Configuration

By default, installation scripts place the binary into ~/.ksp/bin (or ~/.cargo/bin when using Cargo) and automatically append it to your user environment variable. If ksp is not recognized after restarting your terminal, verify your PATH profile:

Bash / Zsh (`~/.bashrc` or `~/.zshrc`)
export PATH="$HOME/.ksp/bin:$HOME/.cargo/bin:$PATH"
Fish (`~/.config/fish/config.fish`)
set -gx PATH $HOME/.ksp/bin $HOME/.cargo/bin $PATH

5. Common Installation Issues & Troubleshooting

Permission Denied (`/usr/local/bin` or `/etc/ksp`) on Linux/macOS

If system-wide installation fails due to missing permissions, either install to user profile without root, or run with sudo:

curl -fsSL https://install.kspprotocol.dev | sudo sh

Missing C++ Build Tools on Windows (cargo install error)

When installing via cargo install ksp --locked, the X25519 and Ring cryptographic dependencies require Microsoft Visual Studio C++ Build Tools (`link.exe`). Download and install the Visual Studio Build Tools with the "Desktop development with C++" workload if compilation fails.

Verifying Installation Health

Whenever in doubt, execute the built-in system doctor diagnostic utility to verify OS permissions, socket access, and configuration files:

ksp doctor --verbose