Open-Source Wikis

/

Tauri

/

Crates

/

tauri-bundler

tauri-apps/tauri

tauri-bundler

Active contributors: Lucas Fernandes Nogueira, Amr Bashir, Fabian-Lars

Purpose

crates/tauri-bundler turns a Cargo-built binary into a platform-native installer or app bundle. It supports:

  • macOS: .app bundle and .dmg (with optional codesigning and notarization via tauri-macos-sign).
  • Linux: .AppImage, .deb, .rpm (and Freedesktop helpers shared between them).
  • Windows: MSI via WiX, EXE via NSIS.
  • Updater bundles: signed archives that the runtime updater can verify.

The bundler is a fork of cargo-bundle (see the SPDX attribution at the top of crates/tauri-bundler/src/lib.rs) and has been carrying its 2016-era ancestry since v0.4.

Directory layout

crates/tauri-bundler/
├── Cargo.toml
├── src/
│   ├── lib.rs                  # crate front-door
│   ├── bundle.rs               # Bundle struct, dispatch by PackageType
│   ├── error.rs                # Error enum
│   ├── utils/                  # shared helpers (file operations, fs walking)
│   └── bundle/
│       ├── settings.rs         # 1,319 lines: Settings / BundleSettings — the canonical input model
│       ├── category.rs         # AppCategory enum (mac LSApplicationCategoryType, etc.)
│       ├── platform.rs         # current platform helpers
│       ├── updater_bundle.rs   # build the signed update archive
│       ├── kmp/                # Korean MIME / package metadata helpers
│       ├── macos/              # .app, .dmg, codesign, ios bundle
│       ├── linux/              # AppImage, debian, rpm, freedesktop
│       └── windows/            # MSI (WiX), NSIS, signing

Key abstractions

Type / function File Role
Bundle crates/tauri-bundler/src/bundle.rs One produced artifact (DMG, MSI, AppImage, …). Returned per platform/format combination.
Settings / BundleSettings crates/tauri-bundler/src/bundle/settings.rs The flattened input model. Built by the CLI from tauri.conf.json plus CLI args.
PackageType crates/tauri-bundler/src/bundle/settings.rs Enum of supported formats (MacOsBundle, IosBundle, Dmg, WindowsMsi, Nsis, AppImage, Deb, Rpm, Updater).
AppCategory crates/tauri-bundler/src/bundle/category.rs Cross-platform app category mapping.
bundle_project crates/tauri-bundler/src/bundle.rs Top-level entry: dispatches to the right per-platform bundler.
macos::app::bundle_project crates/tauri-bundler/src/bundle/macos/app.rs Build the .app directory tree.
macos::dmg::bundle_project crates/tauri-bundler/src/bundle/macos/dmg/ Build a DMG containing the .app.
linux::debian::bundle_project crates/tauri-bundler/src/bundle/linux/debian.rs Produce a .deb.
linux::rpm::bundle_project crates/tauri-bundler/src/bundle/linux/rpm.rs Produce a .rpm.
linux::appimage::bundle_project crates/tauri-bundler/src/bundle/linux/appimage/ Produce an .AppImage via appimagetool.
windows::msi::* crates/tauri-bundler/src/bundle/windows/msi/ Generate WiX XML, run candle.exe and light.exe.
windows::nsis::* crates/tauri-bundler/src/bundle/windows/nsis/ Render NSIS template, run makensis.
updater_bundle::* crates/tauri-bundler/src/bundle/updater_bundle.rs Tar/zip the artefact, sign with Minisign-style keys.

How it works

graph TD
    CLI["tauri build/bundle"] -->|"Settings"| Bundle["bundle_project()"]
    Bundle -->|"macos"| MacOSDMG[".app + .dmg"]
    Bundle -->|"linux"| Linux["AppImage / .deb / .rpm"]
    Bundle -->|"windows"| Win["MSI / NSIS .exe"]
    MacOSDMG -->|"updater_bundle"| Updater["signed .tar.gz"]
    Linux -->|"updater_bundle"| Updater
    Win -->|"updater_bundle"| Updater
    MacOSDMG -.->|"codesign"| Sign["tauri-macos-sign"]

Settings is intentionally bundler-only: it is constructed once by the CLI and then every per-platform module reads what it needs. The bundler does not take a Tauri runtime dependency — it is a pure packaging library and could in principle be called directly by users.

Templates for installer scripts use handlebars. NSIS in particular has its own translation files (Italian, Vietnamese, etc.) under crates/tauri-bundler/src/bundle/windows/nsis/ that are exercised by the .changes/ recently merged PRs.

Cargo features

  • native-tls / native-tls-vendored / rustls-tls — TLS for downloading appimagetool/NSIS plugins/Cocoa frameworks.

Integration points

  • Up: invoked by the CLI (crates/tauri-cli/src/build.rs, bundle.rs) and exposed publicly so other tools (e.g. CI helpers) can call it.
  • Down: depends on tauri-utils (config types, resource walking) and tauri-macos-sign (code signing/notarization).

Entry points for modification

Goal Start here
Add a new bundle format Add a PackageType variant in settings.rs, a new module under bundle/, and dispatch in bundle.rs.
Tweak NSIS template/translations crates/tauri-bundler/src/bundle/windows/nsis/
Tweak WiX/MSI XML templating crates/tauri-bundler/src/bundle/windows/msi/
Change updater archive format crates/tauri-bundler/src/bundle/updater_bundle.rs
Adjust DMG layout crates/tauri-bundler/src/bundle/macos/dmg/
Tweak .deb / .rpm metadata crates/tauri-bundler/src/bundle/linux/debian.rs / rpm.rs

See tauri-cli for the orchestrator and tauri-macos-sign for the codesigning helper.

Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.

tauri-bundler – Tauri wiki | Factory