Safeguard Docs
Safeguard CLI

CLI Installation

Install the Safeguard CLI on macOS, Linux, or Windows

CLI Installation

The Safeguard CLI is a single static binary. There is no runtime to install alongside it — no Node, no Python, no JVM — and nothing it depends on at run time beyond the scanners it downloads on first use.

Install

macOS and Linux

curl -fsSL https://cli.safeguard.sh/install | bash

Windows

irm https://cli.safeguard.sh/install.ps1 | iex

The installer detects your OS and architecture, resolves the current release, verifies the download against the published checksums, and puts one safeguard binary on your PATH.

Confirm it landed:

safeguard --version

If safeguard --version reports a version you do not recognise, you probably have an older copy earlier on your PATH — a go install build under ~/go/bin, for example. Run which -a safeguard (Get-Command safeguard -All on Windows) to see every copy, and remove the ones you do not want.

Read it before you run it

Piping a script from the internet into a shell is worth being careful about. The installer is about a hundred lines of plain bash, and you are welcome to read it first:

curl -fsSL https://cli.safeguard.sh/install -o install.sh && less install.sh
bash install.sh

Never pipe a URL you have not read into a shell — ours included.

Checksum verification

Every release publishes a checksums.txt next to its archives. The installer downloads it, checks the archive it just fetched, and refuses to install on a mismatch.

The two installers differ in one security-relevant way, and it is worth knowing which one you are running:

InstallerMissing checksums.txt
install.sh (macOS / Linux)Fails closed — the install aborts
install.ps1 (Windows)Warns and continues

On Windows, a release with no published checksums file will still install, with a warning printed to the console. If you are installing in an environment where that matters, verify the archive yourself against https://cli.safeguard.sh/releases/<version>/checksums.txt before running the binary.

To skip verification deliberately — an air-gapped mirror that does not carry the checksums file, for instance — set SAFEGUARD_SKIP_CHECKSUM=1. It is an explicit opt-out and it is never the default.

Environment variables

Both installers read two variables:

VariableEffect
SAFEGUARD_VERSIONInstall this exact release instead of the current one
SAFEGUARD_INSTALL_DIRPut the binary here instead of the default location

Pin a release:

curl -fsSL https://cli.safeguard.sh/install | SAFEGUARD_VERSION=1.2.0 bash
$env:SAFEGUARD_VERSION = "1.2.0"; irm https://cli.safeguard.sh/install.ps1 | iex

Choose where it lands:

curl -fsSL https://cli.safeguard.sh/install | SAFEGUARD_INSTALL_DIR="$HOME/bin" bash

Without SAFEGUARD_INSTALL_DIR, the shell installer tries /usr/local/bin and falls back to ~/.local/bin if that is not writable; the PowerShell installer uses %LOCALAPPDATA%\Safeguard\bin and adds it to your user PATH.

Which release you get

The installers resolve the current version from https://cli.safeguard.sh/releases/latest.txt on every run, so a plain install always gets the newest release. Pin SAFEGUARD_VERSION when you need a build to stay put — CI is the usual reason.

curl -fsSL https://cli.safeguard.sh/releases/latest.txt

Platforms

TargetArchive
macOS · Apple Siliconsafeguard_<version>_darwin_arm64.tar.gz
macOS · Intelsafeguard_<version>_darwin_amd64.tar.gz
Linux · x86_64safeguard_<version>_linux_amd64.tar.gz
Linux · arm64safeguard_<version>_linux_arm64.tar.gz
Windows · x86_64safeguard_<version>_windows_amd64.zip

Windows on ARM is not published as its own build. The PowerShell installer detects an ARM64 host, warns, and installs the x86_64 binary, which runs under emulation.

First run

The CLI downloads its scanner toolchain the first time it needs it, so a freshly installed binary has no scanners yet. Open the interactive terminal once and let it complete setup:

safeguard

safeguard update refreshes the vulnerability databases of scanners you already have. It does not install missing ones — that is what the first interactive run is for.

Sign in

Authentication happens inside the interactive terminal:

safeguard

Then type /login. Your browser opens, you approve the session, and the terminal picks it up. /whoami shows who you are signed in as, and /logout ends the session.

See Interactive terminal for what else that terminal does, and Slash commands for the full list.

Updating

Re-run the installer. It resolves the current release and replaces the binary in place:

curl -fsSL https://cli.safeguard.sh/install | bash
irm https://cli.safeguard.sh/install.ps1 | iex

Uninstalling

Delete the binary and its state directory.

rm "$(command -v safeguard)"
rm -rf ~/.sg
Remove-Item "$env:LOCALAPPDATA\Safeguard" -Recurse -Force

~/.sg holds logs and session state. Removing it signs you out and clears the local history; it does not touch anything on the platform.

Next Steps

On this page