Command Line Interface
The Tauri command line interface (CLI) is the way to interact with Tauri throughout the development lifecycle.
You can add the Tauri CLI to your current project using your package manager of choice:
npm install --save-dev @tauri-apps/cli@next
yarn add -D @tauri-apps/cli@next
pnpm add -D @tauri-apps/cli@next
cargo install tauri-cli --version "^2.0.0-beta"
List of Commands
Command | Description |
---|---|
build | Tauri build |
dev | Tauri dev |
icon | Generates various icons for all major platforms |
info | Shows information about Tauri dependencies and project configuration |
init | Initializes a Tauri project |
add | Manage Tauri plugins |
signer | Tauri updater signer |
completions | Shell completions |
ios | iOS commands |
android | Android commands |
migrate | Migrate from v1 to v2 |
permission | Manage permissions |
capability | Manage permissions |
help | Print this message or the help of the given subcommand(s) |
build
npm run tauri build
yarn tauri build
pnpm tauri build
cargo tauri build
Tauri build
Usage: cargo tauri build [OPTIONS] [ARGS]...
Arguments: [ARGS]... Command line arguments passed to the runner
Options: -r, --runner <RUNNER> Binary to use to build the application, defaults to `cargo` -v, --verbose... Enables verbose logging -d, --debug Builds with the debug flag -t, --target <TARGET> Target triple to build against. It must be one of the values outputted by `$rustc --print target-list` or `universal-apple-darwin` for an universal macOS application. Note that compiling an universal macOS application requires both `aarch64-apple-darwin` and `x86_64-apple-darwin` targets to be installed. -f, --features [<FEATURES>...] Space or comma separated list of features to activate -b, --bundles [<BUNDLES>...] Space or comma separated list of bundles to package. Each bundle must be one of `deb`, `appimage`, `msi`, `app` or `dmg` on MacOS and `updater` on all platforms. Note that the `updater` bundle is not automatically added so you must specify it if the updater is enabled. --no-bundle Bundler will be skipped -c, --config <CONFIG> JSON string or path to JSON file to merge with tauri.conf.json --ci Skip prompting for values -h, --help Print help (see a summary with '-h') -V, --version Print version
dev
npm run tauri dev
yarn tauri dev
pnpm tauri dev
cargo tauri dev
Tauri dev
Usage: cargo tauri dev [OPTIONS] [ARGS]...
Arguments: [ARGS]... Command line arguments passed to the runner. Arguments after `--` are passed to the application
Options: -r, --runner <RUNNER> Binary to use to run the application -v, --verbose... Enables verbose logging -t, --target <TARGET> Target triple to build against -f, --features [<FEATURES>...] List of cargo features to activate -e, --exit-on-panic Exit on panic -c, --config <CONFIG> JSON string or path to JSON file to merge with tauri.conf.json --release Run the code in release mode --no-watch Disable the file watcher --no-dev-server Disable the dev server for static files --port <PORT> Specify port for the dev server for static files. Defaults to 1430 Can also be set using `TAURI_DEV_SERVER_PORT` env var --force-ip-prompt Force prompting for an IP to use to connect to the dev server on mobile -h, --help Print help -V, --version Print version
This command will open the WebView in development mode. It makes use of the build.devPath
property from your tauri.conf.json
file.
If you have entered a command to the build.beforeDevCommand
property, this one will be executed before the dev command.
icon
npm run tauri icon
yarn tauri icon
pnpm tauri icon
cargo tauri icon
Generates various icons for all major platforms
Usage: cargo tauri icon [OPTIONS] [INPUT]
Arguments: [INPUT] Path to the source icon (png, 1240x1240px with transparency) [default: ./app-icon.png]
Options: -o, --output <OUTPUT> Output directory. Default: 'icons' directory next to the tauri.conf.json file -v, --verbose... Enables verbose logging -p, --png <PNG> Custom PNG icon sizes to generate. When set, the default icons are not generated --ios-color <IOS_COLOR> The background color of the iOS icon - string as defined in the W3C's CSS Color Module Level 4 <https://www.w3.org/TR/css-color-4/> [default: #fff] -h, --help Print help -V, --version Print version
info
npm run tauri info
yarn tauri info
pnpm tauri info
cargo tauri info
Shows information about Tauri dependencies and project configuration
Usage: cargo tauri info [OPTIONS]
Options: --interactive Interactive mode to apply automatic fixes -v, --verbose... Enables verbose logging -h, --help Print help -V, --version Print version
tauri info
shows a concise list of information about the environment, Rust, Node.js and their versions as well as a few relevant project configurations.
init
npm run tauri init
yarn tauri init
pnpm tauri init
cargo tauri init
Initializes a Tauri project
Usage: cargo tauri init [OPTIONS]
Options: --ci Skip prompting for values -v, --verbose... Enables verbose logging -f, --force Force init to overwrite the src-tauri folder -l, --log Enables logging -d, --directory <DIRECTORY> Set target directory for init [default: C:\Users\Fabian-Lars] -t, --tauri-path <TAURI_PATH> Path of the Tauri project to use (relative to the cwd) -A, --app-name <APP_NAME> Name of your Tauri application -W, --window-title <WINDOW_TITLE> Window title of your Tauri application -D, --dist-dir <DIST_DIR> Web assets location, relative to <project-dir>/src-tauri -P, --dev-path <DEV_PATH> Url of your dev server --before-dev-command <BEFORE_DEV_COMMAND> A shell command to run before `tauri dev` kicks in --before-build-command <BEFORE_BUILD_COMMAND> A shell command to run before `tauri build` kicks in -h, --help Print help -V, --version Print version
add
npm run tauri add
yarn tauri add
pnpm tauri add
cargo tauri add
Installs a plugin on the project
Usage: cargo tauri add [OPTIONS] <PLUGIN>
Arguments: <PLUGIN> The plugin to add
Options: -t, --tag <TAG> Git tag to use -v, --verbose... Enables verbose logging -r, --rev <REV> Git rev to use -b, --branch <BRANCH> Git branch to use -h, --help Print help -V, --version Print version
signer
npm run tauri signer
yarn tauri signer
pnpm tauri signer
cargo tauri signer
Tauri updater signer
Usage: cargo tauri signer [OPTIONS] <COMMAND>
Commands: sign Sign a file generate Generate keypair to sign files help Print this message or the help of the given subcommand(s)
Options: -v, --verbose... Enables verbose logging -h, --help Print help -V, --version Print version
completions
npm run tauri completions
yarn tauri completions
pnpm tauri completions
cargo tauri completions
Shell completions
Usage: cargo tauri completions [OPTIONS] --shell <SHELL>
Options: -s, --shell <SHELL> Shell to generate a completion script for. [possible values: bash, elvish, fish, powershell, zsh] -v, --verbose... Enables verbose logging -o, --output <OUTPUT> Output file for the shell completions. By default the completions are printed to stdout -h, --help Print help -V, --version Print version
The Tauri CLI can generate shell completions for Bash, Zsh, PowerShell and Fish.
Here are some instructions to configure Bash, Zsh and PowerShell. If you face an issue, please follow your shell’s instructions instead. Note that it is recommended to check the generated completions script before executing it for security reasons.
Bash
Get the Bash completions and move to a known folder:
npm run tauri completions -- --shell bash > tauri.shmv tauri.sh /usr/local/etc/bash_completion.d/tauri.bash
yarn tauri completions --shell bash > tauri.shmv tauri.sh /usr/local/etc/bash_completion.d/tauri.bash
pnpm tauri completions --shell bash > tauri.shmv tauri.sh /usr/local/etc/bash_completion.d/tauri.bash
cargo tauri completions --shell bash > tauri.shmv tauri.sh /usr/local/etc/bash_completion.d/tauri.bash
Load the completions script by adding the following to .bashrc
:
source /usr/local/etc/bash_completion.d/tauri.bash
Zsh
Get the Zsh completions and move to a known folder:
npm run tauri completions -- --shell zsh > completions.zshmv completions.zsh $HOME/.completions/_tauri
yarn tauri completions --shell zsh > completions.zshmv completions.zsh $HOME/.completions/_tauri
pnpm tauri completions --shell zsh > completions.zshmv completions.zsh $HOME/.completions/_tauri
cargo tauri completions --shell zsh > completions.zshmv completions.zsh $HOME/.completions/_tauri
Load the completions folder using fpath adding the following to .zshrc
:
fpath=(~/.completions $fpath)autoload -U compinit
PowerShell
Get the PowerShell completions and add it to the $profile
file to execute it on all sessions:
npm run tauri completions -- --shell powershell > ((Split-Path -Path $profile)+"\_tauri.ps1")Add-Content -Path $profile -Value '& "$PSScriptRoot\_tauri.ps1"'
yarn tauri completions --shell powershell > ((Split-Path -Path $profile)+"\_tauri.ps1")Add-Content -Path $profile -Value '& "$PSScriptRoot\_tauri.ps1"'
pnpm tauri completions --shell powershell > ((Split-Path -Path $profile)+"\_tauri.ps1")Add-Content -Path $profile -Value '& "$PSScriptRoot\_tauri.ps1"'
cargo tauri completions --shell powershell > ((Split-Path -Path $profile)+"\_tauri.ps1")Add-Content -Path $profile -Value '& "$PSScriptRoot\_tauri.ps1"'
android
npm run tauri android
yarn tauri android
pnpm tauri android
cargo tauri android
Android commands
Usage: cargo tauri android [OPTIONS] <COMMAND>
Commands: init Initializes a Tauri Android project open Open project in Android Studio dev Android dev build Android build help Print this message or the help of the given subcommand(s)
Options: -v, --verbose... Enables verbose logging -h, --help Print help -V, --version Print version
ios
npm run tauri ios
yarn tauri ios
pnpm tauri ios
cargo tauri ios
iOS commands
Usage: cargo tauri ios [OPTIONS] <COMMAND>
Commands: init Initializes a Tauri iOS project open Open project in Xcode dev iOS dev build iOS build help Print this message or the help of the given subcommand(s)
Options: -v, --verbose... Enables verbose logging -h, --help Print help -V, --version Print version
migrate
npm run tauri migrate
yarn tauri migrate
pnpm tauri migrate
cargo tauri migrate
Migrate from v1 to v2
Usage: cargo tauri migrate [OPTIONS]
Options: -v, --verbose... Enables verbose logging -h, --help Print help -V, --version Print version
permission
npm tauri permission
yarn tauri permission
pnpm tauri permission
cargo tauri permission
Permission commands
Usage: cargo tauri permission <COMMAND>
Commands: new Create a new permission file add Add a permission to capabilities rm Remove a permission file, and its reference from any capability ls List permissions available to your application
new
Create a new permission file
Arguments: [IDENTIFIER] Permission identifier
Options: --description \<DESCRIPTION> Permission description -v, --verbose... Enables verbose logging -a, --allow \<ALLOW> List of commands to allow -d, --deny \<DENY> List of commands to deny --format \<FORMAT> Output file format [default: json] [possible values: json, toml] -o, --out \<OUT> The output file -h, --help Print help -V, --version Print version
add
Add a permission to capabilities
Arguments: <IDENTIFIER> Permission to add [CAPABILITY] Capability to add the permission to
Options: -v, --verbose... Enables verbose logging -h, --help Print help -V, --version Print version
rm
Remove a permission file, and its reference from any capability
Arguments: <IDENTIFIER> Permission to remove
Options: -v, --verbose... Enables verbose logging -h, --help Print help -V, --version Print version
ls
List permissions available to your application
Arguments: [PLUGIN] Name of the plugin to list permissions
Options: -f, --filter \<FILTER> Permission identifier filter -v, --verbose... Enables verbose logging -h, --help Print help -V, --version Print version
capability
npm tauri capability
yarn tauri capability
pnpm tauri capability
cargo tauri capability
Migrate from v1 to v2
Usage: cargo tauri capability [OPTIONS] <COMMAND>
Commands: new Create a new permission file help Print this message or the help of the given subcommand(s)
Options: -v, --verbose... Enables verbose logging -h, --help Print help -V, --version Print version
new
Usage: cargo tauri capability new [OPTIONS] [IDENTIFIER]
Arguments: [IDENTIFIER] Capability identifier
Options: --description <DESCRIPTION> Capability description -v, --verbose... Enables verbose logging --windows <WINDOWS> Capability windows --permission <PERMISSION> Capability permissions --format <FORMAT> Output file format [default: json] [possible values: json, toml] -o, --out <OUT> The output file -h, --help Print help -V, --version Print version
help
npm run tauri help
yarn tauri help
pnpm tauri help
cargo tauri help
Command line interface for building Tauri apps
Usage: cargo tauri [OPTIONS] <COMMAND>
Commands: build Tauri build dev Tauri dev icon Generates various icons for all major platforms info Shows information about Tauri dependencies and project configuration init Initializes a Tauri project plugin Manage Tauri plugins signer Tauri updater signer completions Shell completions android Android commands ios iOS commands migrate Migrate from v1 to v2 help Print this message or the help of the given subcommand(s)
Options: -v, --verbose... Enables verbose logging -h, --help Print help -V, --version Print version
© 2024 Tauri Contributors. CC-BY / MIT