▸ Agent Skills
3 min read

Shell

GitHubnpmcrates.io

API Reference:

Access the system shell. Allows you to spawn child processes.

Supported Platforms

This plugin requires a Rust version of at least 1.77.2

[TABLE]

Opener

If you’re looking for documentation for the shell.open API, check out the new Opener plugin instead.

Setup

Install the shell plugin to get started.

Use your project’s package manager to add the dependency:

npm run tauri add shell
yarn run tauri add shell
pnpm tauri add shell
deno task tauri add shell
bun tauri add shell
cargo tauri add shell
  1. Run the following command in the src-tauri folder to add the plugin to the project’s dependencies in Cargo.toml:

    cargo add tauri-plugin-shell
  2. Modify lib.rs to initialize the plugin:

    #[cfg_attr(mobile, tauri::mobile_entry_point)]pub fn run() {    tauri::Builder::default()        .plugin(tauri_plugin_shell::init())        .run(tauri::generate_context!())        .expect("error while running tauri application");}

    src-tauri/src/lib.rs

  3. Install the JavaScript Guest bindings using your preferred JavaScript package manager:

    npm install @tauri-apps/plugin-shell
    yarn add @tauri-apps/plugin-shell
    pnpm add @tauri-apps/plugin-shell
    deno add npm:@tauri-apps/plugin-shell
    bun add @tauri-apps/plugin-shell

Usage

The shell plugin is available in both JavaScript and Rust.

import { Command } from '@tauri-apps/plugin-shell';// when using `"withGlobalTauri": true`, you may use// const { Command } = window.__TAURI__.shell;
let result = await Command.create('exec-sh', [  '-c',  "echo 'Hello World!'",]).execute();console.log(result);
use tauri_plugin_shell::ShellExt;
let shell = app_handle.shell();let output = tauri::async_runtime::block_on(async move {    shell        .command("echo")        .args(["Hello from Rust!"])        .output()        .await        .unwrap()});if output.status.success() {    println!("Result: {:?}", String::from_utf8(output.stdout));} else {    println!("Exit with code: {}", output.status.code().unwrap());}

Permissions

By default all potentially dangerous plugin commands and scopes are blocked and cannot be accessed. You must modify the permissions in your capabilities configuration to enable these.

See the Capabilities Overview for more information and the step by step guide to use plugin permissions.

{  "$schema": "../gen/schemas/desktop-schema.json",  "identifier": "main-capability",  "description": "Capability for the main window",  "windows": ["main"],  "permissions": [    {      "identifier": "shell:allow-execute",      "allow": [        {          "name": "exec-sh",          "cmd": "sh",          "args": [            "-c",            {              "validator": "\\S+"            }          ],          "sidecar": false        }      ]    }  ]}

src-tauri/capabilities/default.json

Default Permission

This permission set configures which shell functionality is exposed by default.

Granted Permissions

It allows to use the open functionality with a reasonable scope pre-configured. It will allow opening http(s)://, tel: and mailto: links.

This default permission set includes the following:

  • allow-open

Permission Table

IdentifierDescription
shell:allow-executeEnables the execute command without any pre-configured scope.
shell:deny-executeDenies the execute command without any pre-configured scope.
shell:allow-killEnables the kill command without any pre-configured scope.
shell:deny-killDenies the kill command without any pre-configured scope.
shell:allow-openEnables the open command without any pre-configured scope.
shell:deny-openDenies the open command without any pre-configured scope.
shell:allow-spawnEnables the spawn command without any pre-configured scope.
shell:deny-spawnDenies the spawn command without any pre-configured scope.
shell:allow-stdin-writeEnables the stdin_write command without any pre-configured scope.
shell:deny-stdin-writeDenies the stdin_write command without any pre-configured scope.

Support on Open CollectiveSponsor on GitHub

© 2026 Tauri Contributors. CC-BY / MIT


Last updated Oct 08, 2026