To install the Safeguard CLI on Windows, open PowerShell and run irm https://cli.safeguard.sh/install.ps1 | iex. Open a new PowerShell window, check it with safeguard --version, then run safeguard and type /login. After that, /scan . scans the current folder and you can ask the assistant to fix what it finds, with your approval.
You do not have to give up the AI plan you already pay for. Bring the Claude, ChatGPT or Codex plan you already pay for and use it inside the Safeguard CLI. Safeguard adds no extra charge for that usage; your plan's own usage limits and terms still apply. If you would rather stay in your usual chat, connect Claude or ChatGPT to the Safeguard MCP server and use Safeguard from there.
This guide walks through the whole first hour on a Windows machine: what to check before you install, the install itself, signing in, the first scan, the first fix, and the mistakes Windows users tend to hit.
Before you start: what your Windows machine needs
The Safeguard CLI is a single static binary. There is no Node, Python or JVM to install first, and nothing else to set up before the one line installer. A few things are still worth checking.
Architecture. On Windows the CLI ships for x86_64 only. You can check your machine in PowerShell:
$env:PROCESSOR_ARCHITECTURE
AMD64 means x86_64, which is the native build. If you see ARM64, the install still works: the installer detects an ARM64 host, prints a warning, and installs the x86_64 binary, which runs under emulation. There is no native Windows on ARM build of the CLI today.
Disk space. The binary is about 40 MB. On first use it downloads the scanners it needs, so leave room for those as well.
Network. The CLI talks to Safeguard over HTTPS on port 443. If your company routes traffic through a proxy, have the proxy address ready, because you will set HTTP_PROXY and HTTPS_PROXY for the session. If your network inspects TLS with a corporate certificate authority, ask IT for the CA certificate file.
A PowerShell window, not CMD. irm and iex are PowerShell aliases. In Command Prompt they are not recognised. On Windows, your prompt starts with PS when you are in PowerShell.
An account. You sign in through your browser, or with a device code from a second device.
Step by step: install in PowerShell (x86_64)
Step 1: open PowerShell
Open Windows Terminal or the PowerShell app. A normal window is enough for the default install, because the installer puts the binary inside your own profile and adds that folder to your user PATH.
Step 2 (optional): read the script before you run it
The one line installer downloads a script and runs it. irm is the alias for Invoke-RestMethod, which fetches the script text. iex is the alias for Invoke-Expression, which runs a string as a command in your current session. Microsoft's own documentation for Invoke-Expression tells you to verify that a command is safe before you run it, and that is a good habit for any install one liner.
If you want to read it first, split the line in two:
$script = irm https://cli.safeguard.sh/install.ps1
$script | more
Page through it with the space bar. When you are happy, run the text you just read:
$script | iex
A note on execution policy. PowerShell's execution policy controls when script files and configuration files can load. Microsoft is clear that it is not a security boundary; it exists to stop people running scripts by accident. If your organisation manages PowerShell through Group Policy and blocks this pattern, talk to IT rather than changing policy yourself.
Step 3: run the installer
If you skipped Step 2, this is the whole install:
irm https://cli.safeguard.sh/install.ps1 | iex
Here is what it does, according to the installation docs:
- Detects your OS and architecture.
- Resolves the current release.
- Downloads
checksums.txtand verifies the archive against the published checksums. - Places one
safeguardbinary in%LOCALAPPDATA%\Safeguard\bin. - Adds that folder to your user PATH.
Watch the output for one thing. Unlike the macOS and Linux installer, the PowerShell installer does not fail closed: if checksums.txt is missing, it still installs and prints a warning. If you see that warning, stop and verify the archive by hand against https://cli.safeguard.sh/releases/<version>/checksums.txt before you run the binary. There is also a SAFEGUARD_SKIP_CHECKSUM=1 setting that turns verification off. It is an explicit opt out, never the default, and there is rarely a good reason to use it on a developer laptop.
Step 4: open a new window and verify
The installer changes your user PATH, and PowerShell windows that were already open do not pick that up. Close the window, open a fresh one, and run:
safeguard --version
If the version looks unfamiliar, you may have an older copy earlier on your PATH. List every copy:
Get-Command safeguard -All
The first one listed is the one that runs.
Step 5: let the first run finish setup
A brand new install has no scanners yet. Run safeguard once and let the interactive terminal finish its first run setup. This matters: safeguard update only refreshes scanners you already have, so skipping the first interactive run is the usual cause of a "syft binary not found" message later.
Optional: choose the folder or pin a version
To install somewhere other than the default, set SAFEGUARD_INSTALL_DIR before you run the installer. To pin a release instead of taking the current one, set SAFEGUARD_VERSION in the same way:
$env:SAFEGUARD_VERSION = "<version>"; irm https://cli.safeguard.sh/install.ps1 | iex
Replace <version> with a release number from the CLI docs.
Sign in and run your first scan
Move into a project folder and start the CLI with no arguments:
cd C:\src\payments-api
safeguard
That opens the interactive terminal. The bar above the input shows the runner's state, your model and your connection status.
Sign in with /login
Type /login. Your browser opens so you can approve the session, and the terminal picks it up. /whoami confirms who you are signed in as, and /logout ends the session and takes the runner offline. Once you are signed in, the runner also starts polling for scan jobs scheduled from the platform.
If the browser does not open, or the machine has no browser (a build VM, for example), use the device code route from a normal PowerShell prompt:
safeguard login --no-browser
It prints a URL and a short code. Open the URL on any device, enter the code and approve. There is no API key variable for the CLI; the token is stored on the machine that signed in.
Scan the folder you are in
Back in the interactive terminal:
/scan .
When you are signed in, this uploads the SBOM and the findings to your workspace. Your source code does not leave the machine. /status then shows your user, tenant, runner, uptime, job counts and approval mode, and /jobs shows recent scan history.
Or scan straight from PowerShell
The same binary works as a plain command, which is handy in scripts:
safeguard scan --dir .
Get-ChildItem .\output -Recurse -Filter *.json
safeguard scan builds an SBOM and matches it against vulnerability databases. Results land under .\output in a folder per scan, with files such as vuln.json, license.json and collection.json. The other targets follow the same pattern:
safeguard scan --image nginx:latest
safeguard scan --repo https://github.com/org/repo
safeguard scan --sbom sbom.json
Check $LASTEXITCODE after a scan. 0 means the scan ran, whatever it found. 1 means the command itself failed, such as a bad flag or an unreadable target. 2 means results were written but the vulnerability scan did not run. The scan never fails because of findings; gating happens through policy gates in the platform, not in the CLI.
If you need to hand an SBOM to a customer, check it first:
safeguard validate sbom.json --strict -o report.json
safeguard validate checks CycloneDX, SPDX and VEX documents against their specifications.
Do the work properly with the Safeguard CLI
The Safeguard CLI scans code, container images and SBOMs on your own machine, sends only the results to the platform, and includes an assistant that can fix what it finds. It writes code, not only scans it. On Windows that means one tool in PowerShell for the scan, the fix and the check afterwards.
Ask in plain language
Anything you type that does not start with / goes to the assistant. It has tools for your local files and tools for your Safeguard data, and it picks whichever the question needs. The docs give three examples that show the range:
what's the latest file in ~/Downloads
how many critical vulns do we have
fix the lodash CVE in this repo
The first is a question about your machine. The second reads your Safeguard data. The third changes code. Type @ to attach a file from the folder you started in; the picker shows five entries at a time and esc closes it.
Your first fix, with approval
Commit your work first so the change is easy to review. Then ask for the fix:
fix the lodash CVE in this repo, then run the tests
Tools that change things (writing a file, editing code, running a command) ask before they act, according to your approval mode. Read what it proposes, approve it, then check the result with another /scan .. If the finding is gone and the tests pass, review the diff with git diff and commit.
This walkthrough shows the same loop from the platform side: attach a computer running the Safeguard CLI and a folder, ask for a fix, review the diff and approve the command before it runs. The demo itself notes that computer work from Search is available and expanding.
Click through it at your own pace, or open it full screen.
Use your Claude, ChatGPT or Codex plan
Bring the Claude, ChatGPT or Codex plan you already pay for and use it inside the Safeguard CLI. Safeguard adds no extra charge for that usage; your plan's own usage limits and terms still apply. You keep the subscription you chose, and the assistant you work with in PowerShell also knows your findings.
/model shows or switches the model. With no argument it opens a picker; with an argument it switches directly and accepts an ID or a label, so /model griffin-2p and /model Premium do the same thing. For connecting your own plan, follow the CLI docs and the /model picker.
Model choice works the same way across the platform. This walkthrough shows choosing the model for each conversation: Zero z20 answers with no language model at all by turning the question into a platform query, Griffin, Eagle and Lion are Safeguard's models, a tenant admin chooses which model families people may use, and you can bring your own model on your own provider account and route jobs such as chat or summaries to it.
Click through it at your own pace, or open it full screen.
Approvals: Ask, Auto, Yolo
/permissions sets the approval mode. Ask prompts before every action. Auto approves known actions and asks about anything new, and it is the default. Yolo approves everything. The current mode sits in the bar above the input. On a fresh Windows install, Auto is a sensible start; switch to Ask in a repository you do not know well, and keep Yolo for a disposable VM.
CI with safeguard exec
safeguard exec runs one non-interactive assistant turn and exits, which suits a Windows build agent:
safeguard exec --output-format json "summarise the critical findings in this repository"
Its default permission mode is strict: nothing is prompted, and anything your policy file has not pre-approved is denied. It refuses to run outside a git repository unless you pass --skip-git-repo-check, so check out the repository first. Remember that the CLI has no API key variable, so plan how the build machine signs in using the CLI docs.
Windows tips and common mistakes
Most first day problems on Windows come from the shell, not the CLI.
Running the installer in CMD. irm is not recognised in Command Prompt. Open PowerShell and run the line again.
Testing in the old window. "safeguard is not recognised" right after a successful install almost always means the window was open before the PATH changed. Open a new one. If it still fails, run Get-Command safeguard -All and reinstall if nothing is listed.
An old copy shadowing the new one. If safeguard --version shows a version you did not expect, an older build is earlier on your PATH. A stray copy in a Go bin folder is a common cause. Remove it or reorder your PATH.
Ignoring the checksum warning. The PowerShell installer warns but continues if checksums.txt is missing. Treat that warning as a stop sign and verify by hand.
Skipping the first interactive run. If a scan warns and returns nothing, or you see "syft binary not found", run safeguard once and let setup finish, then safeguard update.
Pressing Enter for a new line. Enter sends the message. Use ctrl+j for a newline anywhere, or end a line with a backslash and press Enter. alt+enter does not work in Windows consoles. In Windows Terminal you can bind shift+enter to a newline with a sendInput action in settings.json.
Scrolling with the mouse wheel. The wheel does not scroll the transcript. Use PgUp and PgDn. Normal terminal selection still works for copying, and /copy copies the last response.
Proxy and certificate errors. Behind a proxy, set the variables for the session before you start the CLI:
$env:HTTP_PROXY = "http://proxy.example.com:8080"
$env:HTTPS_PROXY = "http://proxy.example.com:8080"
safeguard doctor
For "certificate error" or "SSL handshake failed", point SSL_CERT_FILE at your corporate CA file, or install the CA in the system trust store. Do not turn off certificate checks.
Starting in the wrong folder. The @ picker and /resume both work from the folder you launched in. If a file is missing from the picker, quit with /quit and restart in the right directory.
Using Yolo as a speed setting. It removes every prompt, including the one before a command runs. Use Auto for daily work.
When in doubt, run safeguard doctor. It checks environment, sign in, tools and policy, lists problems by importance, and changes nothing. Logs live in $env:USERPROFILE\.sg\logs\safeguard.log.
Update and uninstall
To update, run the installer again:
irm https://cli.safeguard.sh/install.ps1 | iex
To uninstall, sign out and remove the install folder:
safeguard logout --yes
Remove-Item "$env:LOCALAPPDATA\Safeguard" -Recurse -Force
How the Windows installs compare
If you already run Claude Code or Codex on Windows, the shapes will feel familiar. This table sticks to what each product's own docs say about Windows.
| Safeguard CLI | Claude Code | Codex | |
|---|---|---|---|
| Install on Windows | One line install.ps1 in PowerShell | One line install.ps1 in PowerShell; also CMD and WinGet | See OpenAI's Windows docs |
| Where it runs | Native Windows, x86_64 build | Native Windows or WSL | Native in PowerShell with a Windows sandbox, or WSL |
| Windows on ARM | x86_64 binary under emulation | x64 or ARM64 processor listed | Not covered here |
| Sign in | /login in the browser, or --no-browser device code | Browser prompts on first run; Pro, Max, Team, Enterprise or Console account | Sign in with ChatGPT or another available method |
| Approvals | Ask, Auto (default), Yolo; exec defaults to strict | Permission modes in the CLI | Sandbox plus a separate approval policy |
| Check the install | safeguard --version, safeguard doctor | claude --version, claude doctor | Not covered here |
Claude Code installs natively on Windows from PowerShell or CMD without running as Administrator. Git for Windows is optional; without it, Claude Code runs shell commands through PowerShell. Its docs list sandboxing as supported under WSL 2 and not on native Windows.
Codex runs on Windows through the ChatGPT desktop app, the CLI or the IDE extension. OpenAI's Windows docs describe a native PowerShell path with a Windows sandbox, and keep WSL as the option for Linux tooling. The sandbox and the approval policy are separate controls.
The Safeguard CLI covers the everyday ground with your approval and adds your vulnerabilities, scans, SBOM validation and the local runner. You can also keep writing with the agent you like and use the Safeguard CLI to scan what it changed before you merge; we cover that in checking coding agent changes with the Safeguard CLI. For a wider look at the options, see Claude Code alternatives and OpenAI Codex alternatives.
FAQ
Do I need administrator rights to install the Safeguard CLI on Windows?
The default install goes into %LOCALAPPDATA%\Safeguard\bin and changes your user PATH, so a normal PowerShell window is enough. If you set SAFEGUARD_INSTALL_DIR to a protected folder, you will need rights to write there.
Does the Safeguard CLI run on Windows on ARM?
Yes, through emulation. There is no native ARM64 build for Windows. The installer detects an ARM64 host, warns you, and installs the x86_64 binary.
Can I keep using my Claude, ChatGPT or Codex plan?
Yes. Bring the Claude, ChatGPT or Codex plan you already pay for and use it inside the Safeguard CLI. Safeguard adds no extra charge for that usage; your plan's own usage limits and terms still apply. You can also connect Claude or ChatGPT to the Safeguard MCP server and use Safeguard from the chat you already use. See the CLI docs or /model for connecting a model.
Will the assistant change my files without asking?
Only if you choose that. Writing a file, editing code and running a command ask before they act, according to your approval mode. Auto is the default; only Yolo approves everything, and you pick it yourself with /permissions.
Does my source code leave my machine?
When the local runner runs platform scan jobs, your source code stays on your machine and only SBOMs and findings are uploaded. Scanning from the interactive terminal with /scan . works the same way.
How do I update the CLI?
Run the installer again. It resolves the current release each time unless you pinned one with SAFEGUARD_VERSION.
Why does safeguard scan return exit code 2?
Results were written, but the vulnerability scan did not run. On a new install this usually means first run setup did not finish. Run safeguard interactively once, then safeguard update, then safeguard doctor.
Can I use it in a Windows CI pipeline?
Yes. safeguard scan, safeguard validate and safeguard exec all run without prompts. safeguard exec needs a git checkout (or --skip-git-repo-check) and --output-format json gives your pipeline something to parse. More on the assistant side is in using the Safeguard CLI as an AI assistant on your machine.
Try it yourself
This walkthrough covers the install and first start: set up the runner on your own machine, pick the platform, start it, approve it with its device code, then use the same CLI to scan from the terminal.
Click through it at your own pace, or open it full screen.
Ready to do it for real? Download Safeguard, run the PowerShell line, open a new window, type safeguard, then /login. The full reference is in the CLI docs.
Quick check
Why should you open a new PowerShell window after installing?
The installer adds its folder to your user PATH, and windows that were already open do not pick up that change. A new window does.
What should you do if the PowerShell installer warns that checksums.txt is missing?
Stop and verify the archive by hand against the published checksums before you run the binary. The PowerShell installer warns but still installs in that case.
Which approval mode is the default?
Auto. It approves known actions and asks about anything new. Change it with /permissions.
Sources
- Safeguard CLI overview
- Safeguard CLI installation
- Safeguard CLI interactive terminal
- Safeguard CLI slash commands
- Safeguard CLI usage guide
- Safeguard CLI troubleshooting
- Safeguard downloads
- Microsoft: Invoke-Expression
- Microsoft: Invoke-RestMethod
- Microsoft: about Execution Policies
- Microsoft: Windows Terminal actions
- Claude Code advanced setup
- Codex on Windows
- Codex CLI docs
Last reviewed: 21 October 2026.