Skip to content

OS Information

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

Install the OS Information plugin to get started.

  1. Use your project’s package manager to add the dependency:
npm run tauri add os
  1. Modify lib.rs to initialize the plugin:
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
tauri::Builder::default()
// Initialize the plugin
.plugin(tauri_plugin_os::init())
.run(tauri::generate_context!())
.expect("error while running tauri application");
}

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

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';
const platform = await platform();
console.log(platform);
// Prints "windows" to the console

© 2023 Tauri Contributors. CC-BY / MIT