Packaging
zero-native provides tooling to bundle your app into distributable packages for macOS, Linux, and Windows. The beta distribution path is macOS-focused; Linux and Windows package support should be treated as roadmap or early support unless your app has validated those targets.
Quick start
Build and package in two steps:
zig build packageOr use the CLI directly with more control:
zero-native package --target macos --manifest app.zon --binary zig-out/bin/MyAppBuild options
The build system exposes options that control platform, web engine, and build features:
| Option | Values | Default | Description |
|---|---|---|---|
-Dplatform | auto, null, macos, linux | auto | Target platform |
-Dweb-engine | system, chromium | app.zon | Temporary WebView engine override |
-Dcef-dir | path | -- | Temporary CEF distribution directory override |
-Dtrace | off, events, runtime, all | events | Trace output level |
-Ddebug-overlay | true, false | false | Enable debug overlay in WebView |
-Dautomation | true, false | false | Enable automation server |
-Djs-bridge | true, false | false | Enable JavaScript bridge |
app.zon packaging fields
The manifest drives packaging metadata:
.{
.id = "com.example.myapp",
.name = "myapp",
.display_name = "My App",
.version = "1.0.0",
.icons = .{ "assets/icon.icns", "assets/icon.ico" },
.platforms = .{ "macos", "linux" },
.web_engine = "system",
.cef = .{ .dir = "third_party/cef/macos", .auto_install = false },
}| Field | Used for |
|---|---|
id | macOS bundle identifier, Linux desktop file, log paths |
display_name | Menu bar name, window title fallback |
version | Info.plist version, package metadata |
icons | Copied into the app bundle per platform convention |
platforms | Which platform packages to generate |
macOS
App bundle
zig build package creates a .app bundle with:
Contents/MacOS/<binary>-- the compiled executableContents/Resources/icon.icns-- the app iconContents/Info.plist-- generated fromapp.zonContents/Resources/dist/-- frontend assets (if configured)
See Code Signing for signing, notarization, and DMG creation.
Linux
Package structure
Linux packaging creates an install tree:
bin/<name>-- the executableshare/applications/<name>.desktop-- desktop entry fileshare/icons/hicolor/.../<name>.png-- icons at standard sizes
zero-native package --target linux --manifest app.zon --binary zig-out/bin/MyAppWindows
zero-native package --target windows --manifest app.zon --binary zig-out/bin/MyApp.exeWindows packaging is in early development. The packager copies the binary and assets into a distributable directory structure.
Frontend assets
Bundle assets
If your app has a frontend build step, bundle the output:
zig build bundle-assetsThis copies the configured dist directory into the build output. Production packages serve these through zero://app/, so paths like /assets/app.js work without file:// URLs.
Configure in app.zon
.frontend = .{
.dist = "dist",
.entry = "index.html",
.spa_fallback = true,
}| Field | Description |
|---|---|
dist | Path to the built frontend output |
entry | HTML entry point within dist |
spa_fallback | Serve entry for unknown routes (SPA mode) |
CEF bundling
When using the Chromium engine, bundle CEF alongside the app:
zig build cef-bundle -Dcef-dir=/path/to/cefThis copies the required CEF framework, libraries, and resources into the app bundle. The CEF distribution must match the target platform and architecture.
Use the same CEF version for install, build, package, and CI verification. The usual app-developer flow is:
zero-native cef install --version <pinned-version>
zig build
zero-native package --target macosSet .web_engine = "chromium" and .cef = .{ .dir = "third_party/cef/macos", .auto_install = false } in app.zon for the normal Chromium package path. Use -Dweb-engine, --web-engine, -Dcef-dir, or --cef-dir only when you need a one-off override.
Verify the Chromium macOS package layout locally with:
zig build test-package-cef-layout -Dplatform=macosThis gated check requires a local CEF layout or -Dcef-auto-install=true and verifies that the packaged app contains the CEF framework and resource files.
Icon generation
Generate platform-specific icon files from a source PNG:
zig build generate-iconThis produces icon.icns (macOS) and icon.ico (Windows) from assets/icon.png.
Validation
Check that your manifest and environment are ready for packaging:
zero-native doctor --manifest app.zon --strict
zero-native validate app.zondoctor checks the host environment, WebView availability, manifest validity, log paths, and optional CEF paths. Add --strict to fail on any warning. See Debugging for details on what zero-native doctor checks.
Platform shortcut commands
In addition to zero-native package --target <platform>, the CLI provides shortcut commands:
zero-native package-windows [--output path] [--binary path]
zero-native package-linux [--output path] [--binary path]
zero-native package-ios [--output path] [--binary path]
zero-native package-android [--output path] [--binary path]Platform targets
| Target | Status |
|---|---|
macos | Full support: .app bundle, signing, notarization, DMG |
linux | Desktop entry, icon install, binary packaging |
windows | Early support: directory-based packaging |
ios | Experimental |
android | Experimental |