# Xbomly installer for Windows. In PowerShell or Command Prompt: # # powershell -ExecutionPolicy ByPass -c "irm https://xbomly.com/install.ps1 | iex" # # What it does, all inside your user profile (no admin rights): # 1. Installs uv (Astral's Python tool installer) if you don't have it. # uv fetches its own Python 3.12 when yours is missing or older than 3.11. # 2. Installs or upgrades the xbomly command from PyPI. # 3. Installs Syft (Anchore's SBOM tool) with winget or Scoop, or from Anchore's release zip # (checksum verified) into %USERPROFILE%\.local\bin. # 4. Runs `xbomly doctor` and adds Xbomly to the Start menu. # # Options (environment variables): # $env:XBOMLY_NO_SYFT = "1" skip Syft # $env:XBOMLY_VERSION = "x.y.z" install a specific scanner version function Install-Xbomly { $ErrorActionPreference = 'Stop' $ProgressPreference = 'SilentlyContinue' [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12 function Say($m) { Write-Host "==> $m" -ForegroundColor Cyan } function Warn($m) { Write-Host "warning: $m" -ForegroundColor Yellow } function Has($name) { [bool](Get-Command $name -ErrorAction SilentlyContinue) } function Add-SessionPath($dir) { if (($env:Path -split ';') -notcontains $dir) { $env:Path = "$dir;$env:Path" } } $bin = Join-Path $env:USERPROFILE '.local\bin' New-Item -ItemType Directory -Force -Path $bin | Out-Null Add-SessionPath $bin # 1. uv. Its installer runs in a child PowerShell, so a failure there can't close this window. $uvCmd = Get-Command uv -ErrorAction SilentlyContinue if ($uvCmd) { $uv = $uvCmd.Source } else { Say 'Installing uv (Python tool installer from astral.sh)' $env:UV_INSTALL_DIR = $bin $shell = (Get-Process -Id $PID).Path & $shell -NoProfile -ExecutionPolicy ByPass -Command 'irm https://astral.sh/uv/install.ps1 | iex' Remove-Item Env:UV_INSTALL_DIR -ErrorAction SilentlyContinue $uv = Join-Path $bin 'uv.exe' if (-not (Test-Path $uv)) { throw 'could not install uv. See https://xbomly.com/download/ for the manual steps' } } # 2. xbomly $spec = 'xbomly' if ($env:XBOMLY_VERSION) { $spec = "xbomly==$env:XBOMLY_VERSION" } Say "Installing $spec" & $uv tool install --force --upgrade --python '>=3.11' $spec if ($LASTEXITCODE -ne 0) { throw 'could not install xbomly. Email team@xbomly.com with the output above' } # Xbomly was called Cbomly until December 2026: remove the old install so only one app is left. # Scans, settings and keys stay; Xbomly moves them over on first start. try { & $uv tool uninstall cbomly *> $null } catch { } try { & $uv tool update-shell *> $null } catch { } $toolBin = (& $uv tool dir --bin).Trim() Add-SessionPath $toolBin # 3. Syft $wingetLinks = Join-Path $env:LOCALAPPDATA 'Microsoft\WinGet\Links' if ($env:XBOMLY_NO_SYFT) { Say 'Skipping Syft (XBOMLY_NO_SYFT is set)' } elseif ((Has 'syft') -or (Test-Path (Join-Path $wingetLinks 'syft.exe'))) { Say 'Syft is already installed' } else { $done = $false if (Has 'winget') { Say 'Installing Syft with winget' winget install --id Anchore.syft --exact --source winget --silent --accept-source-agreements --accept-package-agreements $done = ($LASTEXITCODE -eq 0) -or (Test-Path (Join-Path $wingetLinks 'syft.exe')) } elseif (Has 'scoop') { Say 'Installing Syft with Scoop' scoop install main/syft $done = ($LASTEXITCODE -eq 0) } if (-not $done) { try { Say "Installing Syft from Anchore's release into $bin" $tag = (Invoke-RestMethod 'https://api.github.com/repos/anchore/syft/releases/latest').tag_name $ver = $tag.TrimStart('v') $base = "https://github.com/anchore/syft/releases/download/$tag" $zipName = "syft_${ver}_windows_amd64.zip" $tmp = Join-Path ([IO.Path]::GetTempPath()) ("xbomly-" + [guid]::NewGuid()) New-Item -ItemType Directory -Force -Path $tmp | Out-Null $zip = Join-Path $tmp $zipName Invoke-WebRequest "$base/$zipName" -OutFile $zip -UseBasicParsing $sums = (Invoke-WebRequest "$base/syft_${ver}_checksums.txt" -UseBasicParsing).Content if ($sums -is [byte[]]) { $sums = [Text.Encoding]::UTF8.GetString($sums) } $want = ($sums -split "`n" | Where-Object { $_ -match ('\s' + [regex]::Escape($zipName) + '\s*$') } | Select-Object -First 1) -replace '\s.*$', '' $got = (Get-FileHash $zip -Algorithm SHA256).Hash if (-not $want -or $got -ne $want.Trim().ToUpper()) { throw 'Syft download failed its checksum check' } Expand-Archive $zip -DestinationPath $tmp -Force Copy-Item (Join-Path $tmp 'syft.exe') (Join-Path $bin 'syft.exe') -Force Remove-Item $tmp -Recurse -Force -ErrorAction SilentlyContinue } catch { Warn "could not install Syft ($_). Scans still work, without the software list" } } if (Test-Path $wingetLinks) { Add-SessionPath $wingetLinks } } # 4. Check Write-Host '' & (Join-Path $toolBin 'xbomly.exe') doctor Write-Host '' & (Join-Path $toolBin 'xbomly.exe') app --add-shortcut *> $null if ($LASTEXITCODE -eq 0) { Say 'Done. Open Xbomly from the Start menu, or in a new terminal run: xbomly scan .\your-project' } else { Say 'Done. Open a new terminal, then run: xbomly scan .\your-project' } } try { Install-Xbomly } catch { Write-Host "error: $_" -ForegroundColor Red }