← Back to blog
· 1 min read

Building fast CLI tools in Rust (v2) (DEMO POST)

RustCLIDevOps

Why Rust for CLIs?

Startup time matters for developer tools. A CLI that takes 200ms to start is annoying; one that takes 5ms disappears into the workflow. Rust compiles to a single static binary with no runtime, making it ideal for distribution and speed.

The crate ecosystem

A few crates I reach for on almost every project:

  • clap — argument parsing with derive macros; reduces boilerplate dramatically
  • anyhow / thiserror — ergonomic error handling
  • indicatif — progress bars that don't look terrible
  • serde + serde_json / toml — serialization for config files

Pattern: command enum

Structuring subcommands as an enum with #[derive(Subcommand)] keeps the dispatch logic clean and lets clap generate help text automatically.

Distributing binaries

I use GitHub Actions to cross-compile for Linux (x86_64 + ARM64) and macOS (x86_64 + Apple Silicon) and attach the artifacts to releases. Users install with a single curl | sh script.