# Bundle your app

> Package your app with its frontend and the Chromium runtime for Linux, Windows and macOS.

`kurogane bundle` turns your project into an app you can hand to other people. The bundle carries your binary, your built frontend and the Chromium runtime.

```bash
kurogane bundle
```

It builds a directory on Linux and Windows and a `.app` with a `.dmg` on macOS. The result lands in `dist/`.

> [!NOTE]
> Bundles are platform-specific. Build each platform's bundle on that platform. A Linux AppImage can't come from Windows and a macOS `.app` can't come from Linux.

## Formats

| Format | Command | Platform | Output |
|---|---|---|---|
| Directory | `kurogane bundle --format dir` | Linux, Windows | `dist/` |
| AppImage | `kurogane bundle --format appimage` | Linux | `dist/<name>_<version>_<arch>.AppImage` |
| NSIS installer | `kurogane bundle --format nsis` | Windows | `dist/<name>_<version>_x64-setup.exe` |
| App bundle | `kurogane bundle --format app` | macOS | `dist/<Name>.app` and `dist/<Name>.dmg` |

Every format starts from the same verified bundle. AppImage and NSIS wrap the directory bundle as it is. See [Bundle layouts](https://kurogane-rs.org/docs/shipping/bundle-layouts.md) for what each holds.

## Options

| Option | What it does |
|---|---|
| `--format <format>` | picks the format; `app` on macOS and `dir` elsewhere by default |
| `--debug` | builds with Cargo's dev profile instead of release |
| `--sign` | signs the Windows binaries or the macOS app; see [Code signing](https://kurogane-rs.org/docs/shipping/signing.md) |
| `--ci` | never prompts |

## What you need

| For | Needs |
|---|---|
| every bundle | Rust and the Chromium runtime; `kurogane bundle` installs the runtime when it's missing |
| `--format nsis` | [NSIS](https://nsis.sourceforge.io), or `NSIS_PATH` set to `makensis.exe` |
| `--format app` | `hdiutil` and `sips` (for an icon); both ship with macOS |
| `--format appimage` | nothing extra; the first run downloads a pinned, checksummed linuxdeploy into Kurogane's cache |
| `--sign` | `osslsigncode` or `signtool.exe` on Windows, `codesign` on macOS |

An app needs at least the glibc of the machine that built it. Build Linux bundles on the oldest distribution you support.

## The frontend goes in first

`kurogane bundle` runs `frontend-build` from `kurogane.toml`, builds your Rust code in release mode and copies `frontend-dist` into the bundle's `content`:

```toml
[app]
frontend-dist = "frontend/dist"
frontend-build = "npm --prefix frontend run build"
```

Your release build loads it with `App::new("content")`. That resolves inside the bundle wherever the app starts from. See [app:// and your frontend](https://kurogane-rs.org/docs/concepts/app-protocol.md#relative-directories-in-a-bundle).

Without `frontend-build` build the frontend yourself before bundling. Without `frontend-dist` the bundle has no frontend. That suits an app that loads a URL or serves its own scheme.

## Name and describe your app

`[app]` in `kurogane.toml` names the app in its bundles:

```toml
[app]
name = "Notes"
identifier = "com.example.notes"
publisher = "Example Corp"
description = "A notes app"
copyright = "(c) 2026 Example Corp"
icon = "assets/icon.png"
```

| Key | Used for |
|---|---|
| `name` | the display name; defaults to the Cargo package name |
| `identifier` | the macOS bundle identifier (default `com.kurogane.<name>`) and the AppImage's window class (default the executable's name) |
| `publisher` | the NSIS installer's publisher in Add/Remove Programs |
| `description` | the NSIS installer's file description |
| `copyright` | the NSIS installer's copyright and branding text |
| `icon` | the AppImage icon and the macOS app icon, from a PNG |

Give [`App::window_class`](https://kurogane-rs.org/docs/api/app/app.md#method.window_class) the same `identifier`. The AppImage's launcher then attaches to your windows.

### Per platform

```toml
[linux]
categories = ["Development", "IDE"]
terminal = false

[macos]
minimum-system-version = "13.0"
category = "public.app-category.productivity"

[macos.privacy]
camera = "Calls use your camera."
microphone = "Calls use your microphone."

[windows]
start-menu-shortcut = true
desktop-shortcut = true
```

* `[linux]` sets the desktop entry's categories and whether it runs in a terminal. The default category is `Utility`.
* `[macos]` sets the oldest macOS the app runs on and its App Store category. The minimum can't go below macOS 12. That's the oldest CEF supports.
* `[macos.privacy]` sets what macOS shows when a page asks for the camera or microphone. Every app declares both. Kurogane's generic wording fills any left unset.
* `[windows]` sets the NSIS installer's shortcuts.

`[macos]`, the `[signing]` tables and each resource entry refuse a key they don't know. The error names it and its line.

## Ship extra files

Declare files and directories your app reads at runtime under `[[bundle.resources]]`:

```toml
[[bundle.resources]]
source = "assets/data"
destination = "share/data"
```

`source` is relative to the project root. `destination` is relative to the bundle root and defaults to the source's file name. [`kurogane::resource_dir`](https://kurogane-rs.org/docs/api/app/resource_dir.md) finds them at runtime:

```rust
let data = match kurogane::resource_dir() {
    Some(resources) => resources.join("share/data"),
    None => std::path::PathBuf::from("assets/data"),
};
```

`resource_dir` is `None` outside a bundle. Fall back to the project's path then.

Every link under a resource must lead inside it. A link out of it, a link back to a directory holding it or a link that leads nowhere is refused before anything is packaged. Such a link could otherwise ship a key or a token from elsewhere.

## The Chromium in the bundle

Every bundle carries a Chromium runtime traced to an official CEF release:

* By default it's tanso's installation of the CEF version your app was built against. `kurogane bundle` installs or repairs it first when it's missing, incomplete or unverified.
* `CEF_PATH` names another distribution instead. It must hold a complete runtime, CEF's notices and an `archive.json` naming the exact CEF build for this platform. A `CEF_PATH` that fails a check stops the bundle. It never falls back.

A CEF tree you built or extracted by hand has no provenance and is never packaged. That includes `--debug` bundles. Once bundled your app runs the runtime inside its bundle and no other.

`kurogane install` downloads from CEF's build server. `CEF_DOWNLOAD_URL` names a mirror instead.

## Checks before a bundle exists

Kurogane refuses to write a bundle that wouldn't run:

* The executable exists.
* The display name and executable name are each one file name on every platform.
* The frontend directory has an `index.html`.
* Every extra resource exists and its links stay inside it.
* The Chromium runtime is complete for the platform.

A bundle on disk has passed every check. There is no partial bundle.

## Troubleshooting

### No usable Chromium distribution

The CEF version your app loads isn't installed and `kurogane bundle` couldn't install it (for example when offline). Run this once the download can reach CEF's build server:

```bash
kurogane install
```

`kurogane doctor` shows the expected version, its path and every installed version.

### CEF_PATH is refused

* **No `archive.json`.** The directory has no provenance. Unset `CEF_PATH` or point it at a distribution `export-cef-dir` wrote.
* **No `LICENSE.txt` or `CREDITS.html`.** Every bundle carries CEF's notices. Same fix.
* **Version or platform mismatch.** The directory holds another CEF build or another platform's. The error names the expected values.

### NSIS not found

Install NSIS or point `NSIS_PATH` at it:

```powershell
$env:NSIS_PATH = "C:\Program Files\NSIS\makensis.exe"
```

### linuxdeploy failed

Read the tool's output above the error. The desktop entry's `Icon=` must match a file under `usr/share/icons/hicolor/`. Kurogane installs a placeholder when you give no icon.

### The window is blank in a bundle

Check that `content/` landed in the bundle. Outside a bundle `App::new("content")` falls back to the working directory. That can hide a frontend the bundle doesn't carry. Use `App::new("content")` rather than an absolute path so the app keeps working when the bundle moves.

### Running an AppImage without FUSE

Some CI runners, containers and WSL1 have no FUSE. Extract the image and run its entry point:

```bash
./myapp_1.0.0_x86_64.AppImage --appimage-extract
./squashfs-root/AppRun
```
