uv tool install trailmark # the CLI, in its own environment
uv add trailmark # the library, in a uv-managed projectTrailmark requires Python ≥ 3.12. CI tests Python 3.12 through 3.15. Wheel and source-distribution smoke tests run on Python 3.13 and 3.15 on Linux and macOS, including the bundled native grammars.
Install trailmark[binary] for native ELF, Mach-O, and PE ingestion. The extra
adds lief>=1.0,<2 for container metadata; source-only installations and JSON
binary call-graph imports do not require it. Install LLVM objdump/symbolizer or
GNU binutils objdump/addr2line separately, with the targets you need enabled.
Mach-O and PDB source operations need LLVM companions. Tool implementations are
detected by capabilities, including executables named simply objdump.
See compiled binary evidence for the target matrix and limits.
Trailmark uses three sources of tree-sitter grammars.
The Python bindings support tree-sitter 0.25.2 and 0.26.1. Version 0.26.0 has a native Point lifetime regression and is excluded from the dependency range.
tree-sitter-language-pack provides most languages. Trailmark requires
tree-sitter-language-pack 1.25.2 or newer. The package downloads each grammar
the first time it is used and caches it. Root-owned grammar caches are
supported when they are not group- or other-writable, which lets a system-wide
install share one read-only cache.
tree-sitter-sql provides the SQL grammar. It ships as a wheel dependency
and does not use the language-pack cache.
Bundled grammars ship as C sources inside Trailmark. See
below for build requirements. Grammar licenses, revisions
and local changes are recorded in NOTICE and the grammar directories.
Rego uses a bundled grammar that accepts compound reference indices.
Grammar downloads use the platform certificate store and honor HTTPS_PROXY.
If the target machine cannot download grammars, populate the cache on a
machine with the same platform and copy it over:
python -c "import tree_sitter_language_pack as p; p.download_all()"Then copy the resulting tree-sitter-language-pack cache directory to the same
location on the target machine.
Bundled grammars are compiled the first time a file needs them. This requires a
C compiler (cc), Python development headers, and write access to the installed grammar directories. Ordinary Rust
uses the bundled Rust grammar; verus! blocks additionally load the Verus grammar.
VB.NET also uses a bundled grammar to preserve valid declarations and call sites
that the upstream language-pack grammar misparses.
Compared with v0.8.0, Cairo, VB.NET and Rego now require these build dependencies
on first use. The new Dafny, F*, Rocq, WhyML, Tamarin and ProVerif frontends also
use bundled grammars with the same requirements. Auto mode now detects .lean,
.dfy, .fst/.fsti, .mlw/.why, .tla, .spthy and .pv/.pvl files
that v0.8.0 ignored; Rocq .v files still require explicit language selection.
Lean and TLA+ use downloaded language-pack grammars.
A required grammar's build or load failure stops the analysis,
including an --language auto run that also selected other languages. Install the
build requirements, or explicitly select languages whose grammars are available
(for example, --language python,javascript).
For a read-only deployment, compile the required bindings before removing write
access, using the same Python ABI and platform as the runtime.
Both scanners preserve Unicode code points in block comments. The Rust grammar
matches the revision pinned by language-pack 1.22.1; its provenance and the local
scanner correction are recorded in NOTICE.
If the Verus grammar cannot be built or loaded, Trailmark logs a warning, skips Verus blocks, records a structured parse diagnostic, and continues parsing ordinary Rust. Strict parsing rejects that diagnostic. A compiler failure's warning includes the exit status and stderr.
If the bundled Rust grammar cannot be built or loaded, Trailmark logs one warning per process and parses Rust with the language-pack grammar instead. That scanner can misread Unicode inside block comments; install the build requirements above to restore the corrected scanner.
Compiled bindings are cached under a key derived from the compiled source contents, Python ABI, platform, and compiler options. When any of those change, Trailmark builds a new binding. Completed builds are published atomically, so concurrent processes do not observe a partial build.
nix run github:trailofbits/trailmark -- analyze --summary path/to/project
nix develop github:trailofbits/trailmark # shell with trailmark and uvThe Nix package is built from uv.lock, precompiles the bundled grammars for
the read-only Nix store, and uses a root-owned language-pack grammar cache.
A checkout keeps bundled grammar definitions and generates their C parsers
during the build with Tree-sitter CLI 0.27.2, which needs Node.js.
The build hook pins each generated grammar's ABI in hatch_build.py:
npm ci # installs the pinned Tree-sitter CLI
uv sync --all-groups
uv run trailmark --versionBefore uv sync or uv build, run npm ci with npm install scripts enabled;
the Tree-sitter CLI package downloads its binary from an install script. If
your npm configuration disables scripts, run
npm rebuild tree-sitter-cli --ignore-scripts=false after npm ci.
The generated parser and headers are gitignored. Editable uv installs rerun
the build hook to restore missing generated files, and reuse existing output
when inputs are unchanged. Wheels and source distributions include the
generated sources, so installing published packages needs neither Node.js nor
the Tree-sitter CLI.