InstallRS
A Rust-based framework for building self-contained software installers.
Are you tired of wrestling with clunky installer frameworks? That only compile and run on a developer-unfriendly OS? That force you to write your installer logic in a 1990's scripting language without proper flow control and error handling? That have restrictive licenses and closed-source implementations? Do you want the full power of Rust's ecosystem at your fingertips?
We can do better in 2026. InstallRS is here to revolutionize the way you create software installers.
Features
- Write your installer logic in plain Rust
- Full access to Rust's standard library and third-party crates
- Scans your source code to detect which files need to be embedded
- Embeds those files into a self-contained executable using
include_bytes! - Fluent builder API for installing files and directories, with options for overwrite behavior, Unix permissions, directory filters, and error handlers
- Step-weighted progress tracking with pluggable sinks: each component
declares a
progress_weight; builder ops and manualstep()calls advance a shared cursor, with a streaming API for sub-step updates - Automatically generates both installer and uninstaller binaries
- Supports file compression (lzma, gzip, bzip2) to reduce binary size
- Small binaries — no runtime overhead
- Optional native wizard GUI (welcome, license, components, directory picker,
progress, finish, error) with translatable button labels and page-level
on_enter/on_before_leavecallbacks — Win32 on Windows, GTK3 on Linux on_start/on_exitcallbacks run in both GUI and headless modes — the same wizard definition works either way (--headlessskips the window and runs the install callback inline)- Automatic cancellation: every file/dir/remove/mkdir/uninstaller op checks a shared cancel flag before doing work. The wizard's Cancel button and a Ctrl+C handler (first press cancels, second press exits) both flip it
- Component system: let users pick optional features via wizard checkboxes or
--components/--with/--withoutCLI flags - Built-in native dialog helpers (
info,warn,error,confirm) - Built-in payload integrity check: a SHA-256 of the embedded compressed blobs is baked into the installer at build time and verified at startup, so a corrupted download is detected before any file operations run
- Windows resource support: icons (PNG auto-converted to ICO), version info, manifests
- Separate configuration for installer and uninstaller binaries
Usage
Write a library crate with install and uninstall functions:
use Result;
use ;
Then build with the installrs CLI:
See the example/ directory for a working example.
Source paths and the source! macro
Embedded files and directories are referenced by the source!("path") macro,
which evaluates to a Source newtype at compile time. The build tool scans
your source for source!(...) invocations, and embeds the corresponding file
(or directory tree, decided by filesystem metadata at build time).
Pass the result directly to Installer::file or Installer::dir:
i.file.install?;
i.dir.install?;
The macro also accepts build-time-only keyword options that the scanner
reads from the source — the runtime expansion still evaluates to a
Source(u64). Supported keys:
ignore = ["glob", ...]— extra glob patterns applied when gathering a directory, merged (union) with the CLI--ignorelist. Repeat references to the same path across the installer/uninstaller merge their ignore lists, so only one declaration needs to carry it.
i.dir.install?;
Builder options
Every install operation returns a builder that terminates with .install().
Common chainable options:
i.file
.status // pushes to the GUI status label
.log // pushes to the log area
.overwrite // Overwrite | Skip | Error | Backup
.mode // Unix only
.install?;
i.dir
.filter // skip matching entries
.on_error
.install?;
Progress reporting
Progress is step-weighted per component. Each component you register
declares a progress_weight — the number of step units it contributes to
the bar when selected. The total is the sum of selected components'
weights. Every builder op (.file().install(), .dir().install(), etc.)
advances the cursor by its own weight (default 1, override with
.weight(n)). If your actual op count differs from the declared
progress_weight, the bar just over- or undershoots — it's an estimate,
not a contract.
For custom work that isn't a builder op (downloads, service registration, etc.) use:
i.step("msg", weight)— one-shot advance + status messagei.begin_step("msg", weight)+i.set_step_progress(fraction)+i.end_step()— for streaming within a single step (e.g. download progress advances the bar smoothly from step-start to step-end)
Attach any ProgressSink via set_progress_sink; the GUI wizard attaches
one automatically. All .status(), .log(), and progress updates flow
through the sink.
Installer API
| Method | Description |
|---|---|
set_out_dir(dir) |
Set the base directory for relative output paths |
file(src, dest) |
Install a single embedded file |
dir(src, dest) |
Install an embedded directory tree |
mkdir(dir) |
Create a directory |
uninstaller(dest) |
Write the uninstaller executable |
remove(path) |
Remove a file or directory |
exists(path) |
Check whether a path exists |
exec_shell(cmd) |
Run a shell command |
set_progress_sink(sink) |
Attach a ProgressSink for status & progress |
total_steps() |
Sum of selected components' progress_weight |
step(msg, weight) |
One-shot: advance cursor + emit status |
begin_step(msg, weight) |
Open a weighted step for streaming sub-updates |
set_step_progress(fraction) |
Update position within the open step (0.0..=1.0) |
end_step() |
Close the open step (jump to its end) |
reset_progress() |
Reset the step cursor to zero |
enable_self_delete() |
Windows: relaunch from copy so original can be deleted |
component(id, label, desc, weight) |
Register an optional component |
is_component_selected(id) |
Check whether a component is currently selected |
set_component_selected(id, on) |
Enable/disable a component |
process_commandline() |
Required. Parse registered CLI args |
set_log_file(path) |
Tee status messages to a file (see --log option) |
log_error(&err) |
Manually record an error line to the log file |
option(name, kind) |
Register a user-defined CLI option |
get_option::<T>(name) |
Typed accessor for a parsed user option |
option_value(name) |
Raw &OptionValue for a parsed user option |
cancel() / check_cancelled() |
Set / error-if-set the cancellation flag |
Components
Register optional features with
i.component(id, label, description, progress_weight). Components start
selected by default; call .default_off() on ones the user has to opt
into, and .required() on ones that can't be unchecked:
i.component
.required;
i.component;
i.component
.default_off;
Branch on selection inside the install callback:
if i.is_component_selected
The wizard renders a components_page(...) with one checkbox per component
(required ones greyed-out). Users can also drive the installer from the
command line:
--headless— disable the GUI--list-components— print available components and exit 0--components a,b,c— install exactly this set (required always included)--with a,b/--without c— delta from defaults--log <path>— tee everystatus/log/ error message to a file (append mode).
All installers must call i.process_commandline()? after registering
components (before running the wizard or doing headless work). This parses
argv and applies the flags above.
Custom command-line options
Register your own flags via i.option(name, OptionKind) before calling
process_commandline(), then read them afterwards with a typed getter:
use OptionKind;
i.option; // --config /path
i.option; // --port 8080
i.option; // --verbose (presence = true)
i.option; // --fast true|false|yes|no|on|off
i.process_commandline?;
let config: = i.get_option;
let port: i64 = i.get_option.unwrap_or;
let verbose: bool = i.get_option.unwrap_or;
get_option::<T> is generic over FromOptionValue, which is implemented
for bool, String, i64, i32, u64, and u32. Unknown flags now
cause process_commandline() to return an error — register everything you
expect users to pass.
GUI
Enable the optional wizard by setting gui = true in
[package.metadata.installrs]. The build tool picks the backend based on
the target triple: Win32 on Windows (winsafe), GTK3 on Linux
(gtk-rs). In your install / uninstall functions, build the wizard
with InstallerGui::wizard():
use *;
// Register components up front (optional).
i.component;
// Required: parse CLI flags (--headless, --components, etc.).
i.process_commandline?;
wizard
.title
.welcome
.license
.components_page
.directory_picker
.on_before_leave
.install_page
.finish_page
.error_page
.run?;
If the install callback returns an error (including cancellation via the
Cancel button or Ctrl+C), the wizard navigates to the error page — the
provided message sits above an auto-populated text area showing the
actual error. Without an .error_page(...), failures fall back to a
native error dialog instead.
For the uninstall flow, use .uninstall_page(cb) instead of
.install_page(cb). It behaves identically but causes the preceding Next
button to render ButtonLabels::uninstall (default "Uninstall"), so
users don't see "Install" on the button that kicks off an uninstall.
Customize the label by passing .buttons(ButtonLabels { uninstall: "Desinstalar".into(), ..Default::default() }).
Page-level on_enter and on_before_leave callbacks fire only on
forward navigation — the Back button walks backwards without re-running
either callback, so you won't prompt the user for confirmation when
they're just retreating.
Custom pages
.custom_page(heading, label, |p| { ... }) lays out a column of simple
widgets — text fields, checkboxes, and dropdowns — each bound to an
installer option by key:
.custom_page
.on_before_leave
Widgets pre-fill from the options store on entry and write back on
forward navigation — so --username=alice on the command line
pre-fills the field (as long as you registered the option via
i.option("username", OptionKind::String) before
process_commandline). Validation lives in on_before_leave:
return Ok(false) to keep the user on the page.
Native dialog helpers (installrs::gui::info, warn, error, confirm)
wrap MessageBox (Win32) or gtk::MessageDialog (GTK3) with the wizard
window as parent.
For a pre-wizard language selector, installrs::gui::choose_language(title, prompt, &[(code, display), ...], default_code) -> Result<Option<String>>
shows a modal dropdown and returns the selected code (or None if
dismissed). Run it before building the wizard — page strings are
captured eagerly, so the locale must be final by then:
init_locale; // read system locale
if let Some = choose_language?
wizard
.title // now uses chosen locale
// ...
Headless mode
When --headless is passed (and applied via i.process_commandline()),
InstallerGui::run skips the window and runs the install callback inline.
Status / log messages emit to stderr instead of the install-page log. Pair
with .on_start(...) and .on_exit(...) for setup and cleanup that must
happen in both modes:
wizard
.on_start
.on_exit
// ... pages ...
.install_page
.run?;
on_start runs before the window opens (or before the install callback in
headless mode). on_exit runs after the window closes (or after install in
headless mode) — even if the install failed.
On Linux, target systems need GTK3 runtime libraries installed
(libgtk-3-0 and its dependencies — present by default on virtually all
desktop distros). Building a Linux installer also requires GTK3 dev
headers on the build host (libgtk-3-dev on Debian/Ubuntu,
gtk3-devel on Fedora/RHEL).
Command Line Options
)
)
)
)
)
)
Windows Resource Configuration
Configure icons, version info, and manifests via [package.metadata.installrs]
in your installer's Cargo.toml. Shared settings apply to both installer
and uninstaller; use [package.metadata.installrs.installer]
and […uninstaller] sub-tables to override per-binary.
# Shared defaults
[]
= "assets/app.png" # .png or .ico — PNG auto-converts to ICO
= [16, 32, 48, 256] # optional, defaults to [16, 32, 48, 64, 128, 256]
= 0x0409 # Windows LANGID
= "console" # "console" or "windows"
= "requireAdministrator" # manifest: asInvoker, requireAdministrator, highestAvailable
= "permonitorv2" # manifest: true, false, system, permonitor, permonitorv2
= ["7", "8", "8.1", "10"] # manifest: vista, 7, 8, 8.1, 10 (defaults to all)
= "My App"
= "1.0.0.0"
= "1.0.0.0"
= "Copyright (c) 2026"
# Installer-specific overrides
[]
= "My App Installer"
= "installer.exe"
# Uninstaller-specific overrides
[]
= "My App Uninstaller"
= "uninstaller.exe"
Requirements
- Rust toolchain (stable)
- The target crate must be a library crate exporting
installanduninstall
License
This project is licensed under the MIT License. See the LICENSE.txt file for details.
Contributing
Contributions are welcome! Please feel free to submit issues and pull requests.