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://registry.safeguard.sh/cli/safeguard/install | bashWindows
irm https://registry.safeguard.sh/cli/safeguard/install.ps1 | iexThe 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.
Download it yourself
Every release, the current one and the older ones, is on the download page at
registry.safeguard.sh/cli/safeguard,
with an archive for each OS and architecture and the release's
checksums.txt. Unpack the archive and put the safeguard binary anywhere on
your PATH. The direct links follow one pattern:
https://registry.safeguard.sh/cli/safeguard/releases/<version>/safeguard_<version>_<os>_<arch>.tar.gz<version> is the release tag, v11.11.0 for example, <os> is linux, darwin or windows (a .zip on Windows) and <arch> is
amd64 or arm64 (Windows is amd64 only).
Confirm it landed:
safeguard --versionIf 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://registry.safeguard.sh/cli/safeguard/install -o install.sh && less install.sh
bash install.shNever 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:
| Installer | Missing 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://registry.safeguard.sh/cli/safeguard/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:
| Variable | Effect |
|---|---|
SAFEGUARD_VERSION | Install this exact release instead of the current one |
SAFEGUARD_INSTALL_DIR | Put the binary here instead of the default location |
Pin a release. Substitute the release you want for <version>, the current
one is 11.11.0, and every published
release is listed on the download page:
curl -fsSL https://registry.safeguard.sh/cli/safeguard/install | SAFEGUARD_VERSION=<version> bash$env:SAFEGUARD_VERSION = "<version>"; irm https://registry.safeguard.sh/cli/safeguard/install.ps1 | iexChoose where it lands:
curl -fsSL https://registry.safeguard.sh/cli/safeguard/install | SAFEGUARD_INSTALL_DIR="$HOME/bin" bashWithout 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://registry.safeguard.sh/cli/safeguard/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://registry.safeguard.sh/cli/safeguard/releases/latest.txtPlatforms
| Target | Archive |
|---|---|
| macOS · Apple Silicon | safeguard_<version>_darwin_arm64.tar.gz |
| macOS · Intel | safeguard_<version>_darwin_amd64.tar.gz |
| Linux · x86_64 | safeguard_<version>_linux_amd64.tar.gz |
| Linux · arm64 | safeguard_<version>_linux_arm64.tar.gz |
| Windows · x86_64 | safeguard_<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:
safeguardsafeguard 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:
safeguardThen 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
Run safeguard self-update, or re-run the installer. It resolves the current release and replaces the binary
in place:
curl -fsSL https://registry.safeguard.sh/cli/safeguard/install | bashirm https://registry.safeguard.sh/cli/safeguard/install.ps1 | iexUninstalling
Delete the binary and its state directory.
safeguard logout --yes
rm "$(command -v safeguard)"
rm -rf ~/.sg ~/.scanner ~/.cliRemove-Item "$env:LOCALAPPDATA\Safeguard" -Recurse -Force~/.sg holds logs and local history, ~/.scanner holds the sign-in token,
and ~/.cli holds the deployment config if you ran safeguard init. Removing
them does not touch anything on the platform.