FAQ - Help and questions
How can a Rust desktop app update itself, and what must I get right?
Short answer
The common designs are an update check that sends the user to a download, an app that downloads and runs a new installer, or an updater framework such as Sparkle on macOS or the Tauri updater plugin. Updates must be signed and fetched over HTTPS, and versions compared as numbers, not text.
Checked with rustc 1.93.0, Windows 11; the version comparison program was compiled and run. The updater frameworks are described from their own documentation, read on 2026-12-05, and were not run.
Frequently asked question, written and answered by the Ruststudio team. Replies are open: corrections are welcome.
3 answers from the Ruststudio team: different approaches, each with its own trade-offs
Sort: Oldest NewestApproach 1: tell the user, and link to the download#
The app fetches a small file from your server (for example latest.json with a version number and a URL), compares it with its own version, and shows "Version X is available" with a button that opens the page in the browser.
The comparison is where beginners go wrong: as text, "1.10.0" is smaller than "1.9.2". Compare the numbers:
/// Parses "1.2.3" (an optional leading "v" is allowed) into numbers that compare correctly.
/// Pre-release suffixes such as "-beta.1" are not handled: use the `semver` crate when you need them.
fn parse(v: &str) -> Option<(u64, u64, u64)> {
let mut it = v.trim().trim_start_matches('v').split('.');
let t = (it.next()?.parse().ok()?, it.next()?.parse().ok()?, it.next()?.parse().ok()?);
if it.next().is_some() { None } else { Some(t) }
}
fn is_newer(available: &str, running: &str) -> Option<bool> {
Some(parse(available)? > parse(running)?)
}
fn main() {
println!("{:?}", is_newer("1.10.0", "1.9.2")); // as numbers, 10 > 9
println!("{:?}", is_newer("v1.2.3", "1.2.3"));
println!("{:?}", is_newer("2.0", "1.9.9")); // not three parts: refuse to guess
println!("string compare says 1.10.0 > 1.9.2: {}", "1.10.0" > "1.9.2"); // the classic bug
}Some(true)
Some(false)
None
string compare says 1.10.0 > 1.9.2: falseTrade-off: no installer logic and almost nothing that can go wrong; the user does the update by hand. Do the check on a worker thread (see the threading threads), with a timeout, and ignore failures quietly: an offline user must not see an error.
Approach 2: download the installer and start it#
The app downloads the new installer (or archive) to a temporary folder, verifies it, starts it and exits so the installer can replace the files. This works well on Windows with an MSI or setup program.
Two details decide whether it is safe:
- Verify before running. At minimum check a hash published over HTTPS; better, check the file's code signature or a signature made with a key you control and compiled into the app. A download that is run without a check is a way to run anything on your users' PCs.
- A running program cannot be overwritten on Windows. That is why the update is done by a separate process after your app exits. The thread on updating a running executable shows the real error.
Trade-off: you write the download, verification and restart logic, and must protect the signing key.
Approach 3: use an updater framework#
Frameworks do all four jobs and, importantly, the signature check:
- Sparkle is an open-source update framework for macOS apps. Its documentation describes an appcast (an RSS feed pointed to from
Info.plist) and EdDSA signatures: you sign update archives with a key pair, the public key goes into the app, and the signature lets Sparkle confirm that "a downloaded update is not corrupted and came from you". It recommends HTTPS, Developer ID signing and notarization. - The Tauri updater plugin requires signed updates; its documentation says "Tauri's updater needs a signature to verify that the update is from a trusted source", with the public key in the app configuration and a private key you keep secret. The update information is a JSON file or a dynamic server response with a version, a URL and a signature per platform.
- cargo-packager lists a companion updater crate in its README.
Trade-off: less code of your own, but you accept the framework's packaging format and must manage its signing key. Losing the private key can stop future updates reaching existing installs; Tauri's documentation says this about its key, and the same logic holds for any scheme, so back it up.
Common mistakes#
- Updating over plain HTTP.
- Checking for updates on the UI thread at startup, so a slow network delays the window.
- Auto-installing without asking, or with no way to turn it off.
- No way to roll back: keep the previous installer available.
Sources#
- Sparkle documentation: https://sparkle-project.org/documentation/ (read 2026-12-05)
- Tauri updater plugin: https://v2.tauri.app/plugin/updater/ (read 2026-12-05)
- cargo-packager: https://github.com/crabnebula-dev/cargo-packager (read 2026-12-05)
Sign in to reply
A free account lets you answer, vote and follow topics.
Posts show your first name and last initial. Forum rules