▸ Agent Skills
3 min read

OS Information

GitHubnpmcrates.io

API Reference:

Read information about the operating system using the OS Information plugin.

Supported Platforms

This plugin requires a Rust version of at least 1.77.2

[TABLE]

Setup

Install the OS Information plugin to get started.

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

npm run tauri add os
yarn run tauri add os
pnpm tauri add os
deno task tauri add os
bun tauri add os
cargo tauri add os
  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-os
  2. Modify lib.rs to initialize the plugin:

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

    src-tauri/src/lib.rs

  3. If you’d like to use in JavaScript then install the npm package as well:

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

Usage

With this plugin you can query multiple information from current operational system. See all available functions in the JavaScript API or Rust API references.

Example: OS Platform

platform returns a string describing the specific operating system in use. The value is set at compile time. Possible values are linux, macos, ios, freebsd, dragonfly, netbsd, openbsd, solaris, android, windows.

import { platform } from '@tauri-apps/plugin-os';// when using `"withGlobalTauri": true`, you may use// const { platform } = window.__TAURI__.os;
const currentPlatform = platform();console.log(currentPlatform);// Prints "windows" to the console
let platform = tauri_plugin_os::platform();println!("Platform: {}", platform);// Prints "windows" to the terminal

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.

{  "permissions": [    ...,    "os:default"  ]}

src-tauri/capabilities/default.json

Default Permission

This permission set configures which operating system information are available to gather from the frontend.

Granted Permissions

All information except the host name are available.

This default permission set includes the following:

  • allow-arch
  • allow-exe-extension
  • allow-family
  • allow-locale
  • allow-os-type
  • allow-platform
  • allow-version

Permission Table

IdentifierDescription
os:allow-archEnables the arch command without any pre-configured scope.
os:deny-archDenies the arch command without any pre-configured scope.
os:allow-exe-extensionEnables the exe_extension command without any pre-configured scope.
os:deny-exe-extensionDenies the exe_extension command without any pre-configured scope.
os:allow-familyEnables the family command without any pre-configured scope.
os:deny-familyDenies the family command without any pre-configured scope.
os:allow-hostnameEnables the hostname command without any pre-configured scope.
os:deny-hostnameDenies the hostname command without any pre-configured scope.
os:allow-localeEnables the locale command without any pre-configured scope.
os:deny-localeDenies the locale command without any pre-configured scope.
os:allow-os-typeEnables the os_type command without any pre-configured scope.
os:deny-os-typeDenies the os_type command without any pre-configured scope.
os:allow-platformEnables the platform command without any pre-configured scope.
os:deny-platformDenies the platform command without any pre-configured scope.
os:allow-versionEnables the version command without any pre-configured scope.
os:deny-versionDenies the version command without any pre-configured scope.

Support on Open CollectiveSponsor on GitHub

© 2026 Tauri Contributors. CC-BY / MIT


Last updated Oct 08, 2026