On CI runners, in Docker images, and on Linux or macOS developer machines, the standalone CLI build is the right approach. One self-contained binary, no runtime prerequisite, a single archive to unpack.
Which build for which platform
| File | For |
|---|---|
codecharter-X.Y.Z-win-x64.zip |
Windows x64 |
codecharter-X.Y.Z-linux-x64.tar.gz |
Linux x64 (glibc-based) |
codecharter-X.Y.Z-osx-x64.tar.gz |
macOS Intel |
codecharter-X.Y.Z-osx-arm64.tar.gz |
macOS Apple Silicon |
All four are available in the portal at /downloads.
Download and unpack
# Example: Linux x64
curl -L -o codecharter.tar.gz \
-H "Authorization: Bearer $CODECHARTER_API_KEY" \
https://codecharter.tools/api/v1/cli/linux-x64/latest
mkdir -p /opt/codecharter
tar -xzf codecharter.tar.gz -C /opt/codecharter
chmod +x /opt/codecharter/codecharter
/opt/codecharter/codecharter --version
On macOS you may need to click through the Gatekeeper check on first launch (System Settings → Privacy & Security → "Open Anyway") or remove the quarantine attribute:
xattr -dr com.apple.quarantine /opt/codecharter
We are not notarizing the binaries at this time. If that is a problem for you on macOS, let us know — we can add the step to the release workflow.
In Docker
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
WORKDIR /app
COPY . .
RUN dotnet build -c Release
FROM mcr.microsoft.com/dotnet/runtime:9.0
WORKDIR /app
ARG CODECHARTER_API_KEY
RUN mkdir -p /opt/codecharter \
&& curl -sSL -H "Authorization: Bearer $CODECHARTER_API_KEY" \
-o codecharter.tar.gz \
https://codecharter.tools/api/v1/cli/linux-x64/latest \
&& tar -xzf codecharter.tar.gz -C /opt/codecharter \
&& rm codecharter.tar.gz \
&& chmod +x /opt/codecharter/codecharter
ENV PATH="/opt/codecharter:${PATH}"
COPY --from=build /app/publish ./
RUN codecharter analyze . --output sarif --output-file codecharter.sarif
Caching in CI
The archives are small (5–10 MB). If your CI provider supports caching, cache the unpacked directory rather than the archive. Unpacking is the more expensive operation compared to downloading.
GitHub Actions caches automatically when you use the official Action. See GitHub Actions.
Version pinning
Instead of /latest/ you can pin a specific version:
https://codecharter.tools/api/v1/cli/linux-x64/1.4.0
We recommend this for reproducible builds. See Versioning.
PATH setup
If you do not have the CLI directory on the PATH, you can use the full path. For a persistent PATH setup on a workstation:
# Linux/macOS, in .bashrc or .zshrc
export PATH="/opt/codecharter:$PATH"
# Windows
[Environment]::SetEnvironmentVariable("PATH",
"$env:PATH;C:\codecharter", "User")