Tauri applications for macOS are distributed either with an Application Bundle (
.app file) or an Apple Disk Image (
.dmg file). The Tauri CLI automatically bundles your application code in these formats, providing options to codesign and notarize your application. Please note that
.dmg bundles can only be created on macOS as cross-compilation doesn't work yet.
GUI apps on macOS and Linux do not inherit the
$PATH from your shell dotfiles (
.zshrc, etc). Check out Tauri's fix-path-env-rs crate to fix this issue.
To build and bundle your Tauri application into a single executable simply run the following command:
npm run tauri build
yarn tauri build
pnpm tauri build
cargo tauri build
Genererà il tuo frontend (se configurato, vedi
beforeBuildCommand), compilerà il binario Rust, raccoglierà tutti i binari e le risorse esterne e infine produrrà pacchetti e programmi d'installazione puliti, specifici per piattaforme.
Setting a Minimum System Version
The minimum version of the operating system required for a Tauri app to run on macOS is
10.13. If you need support for newer macOS APIs like
window.print that is only supported from macOS version
11.0 onwards, you can change the
tauri.bundle.macOS.minimumSystemVersion. This will in turn set the
Info.plist LSMinimumSystemVersion property and the
MACOSX_DEPLOYMENT_TARGET environment variable.
You can compile your application targeting Apple Silicon, Intel-based Mac computers, or universal macOS binaries. By default, the CLI builds a binary targeting your machine's architecture. If you want to build for a different target you must first install the missing rust target for that target by running
rustup target add aarch64-apple-darwin or
rustup target add x86_64-apple-darwin, then you can build your app using the
tauri build --target aarch64-apple-darwin: targets Apple silicon machines.
tauri build --target x86_64-apple-darwin: targets Intel-based machines.
tauri build --target universal-apple-darwin: produces a universal macOS binary that runs on both Apple silicon and Intel-based Macs.
While Apple silicon machines can run applications compiled for Intel-based Macs through a translation layer called Rosetta, this leads to a reduction in performance due to processor instruction translations. It is common practice to let the user choose the correct target when downloading the app, but you can also choose to distribute a Universal Binary. Universal Binaries include both
x86_64 executables, giving you the best experience on both architectures. Note, however, that this increases your bundle size significantly.
Application Bundle Customization
The Tauri configuration file provides the following options to customize your application bundle:
- Bundle name: Your app's human-readable name. Configured by the
- Bundle version: Your app's version. Configured by the
- Application category: The category that describes your app. Configured by the
tauri.bundle.categoryproperty. You can see a list of macOS categories here.
- Copyright: A copyright string associated with your app. Configured by the
- Bundle icon: Your app's icon. Uses the first
.icnsfile listed in the
- Minimum system version: Configured by the
- DMG license file: A license that is added to the
.dmgfile. Configure by the
- Entitlements.plist file: Entitlements control what APIs your app will have access to. Configured by the
- Exception domain: an insecure domain that your application can access such as a
localhostor a remote
httpdomain. It is a convenience configuration around
NSAppTransportSecurity > NSExceptionDomainssetting
NSIncludesSubdomainsto true. See
tauri.bundle.macOS.exceptionDomainfor more information.
These options generate the application bundle Info.plist file. You can extend the generated file with your own
Info.plist file stored in the Tauri folder (
src-tauri by default). The CLI merges both
.plist files in production, and the core layer embeds it in the binary during development.