Link Search Menu Expand Document

Tauri

Setup for macOS

brew install gcc

Rustc and Cargo Package Manager

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
...

info: default toolchain set to 'stable-x86_64-apple-darwin'

  stable-x86_64-apple-darwin updated - rustc 1.54.0 (a178d0322 2021-07-26) (from rustc 1.53.0 (53cb7b09b 2021-06-17))


Rust is installed now. Great!

To get started you may need to restart your current shell.
This would reload your PATH environment variable to include
Cargo's bin directory ($HOME/.cargo/bin).

To configure your current shell, run:
source $HOME/.cargo/env
rustc --version
rustc 1.54.0 (a178d0322 2021-07-26)

Tauri Integration

Install Tauri CLI Package as a Dev Dependency

yarn add -D @tauri-apps/cli

Initialize Tauri in Your App

yarn tauri init

Check tauri info to Make Sure Everything Is Set up Properly

yarn tauri info
...

Operating System - Mac OS, version 11.5.0 X64

Node.js environment
  Node.js - 14.17.3
  @tauri-apps/cli - 1.0.0-beta.6
  @tauri-apps/api - Not installed

Global packages
  npm - 6.14.13
  yarn - 1.22.11

Rust environment
  rustc - 1.54.0
  cargo - 1.54.0

App directory structure
/node_modules
/ios
/public
/android
/scripts
/src-tauri
/.gradle
/build
/.git
/electron
/src

App
  tauri.rs - 1.0.0-beta.5
  build-type - bundle
  CSP - default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self' img-src: 'self'
  distDir - ../build
  devPath - http://localhost:8100
  framework - React

✨  Done in 11.19s.

App Development

Start Your Devserver

Now that you have everything setup, you should start your application development server provided by your UI framework or bundler (assuming you're using one, of course).

yarn dev

Start Tauri Development Window

yarn tauri dev

App Publishing

Build Your Web App

Now that you are ready to package your project, you will need to run your framework's or bundler's build command (assuming you're using one, of course).

yarn build

Bundle your application with Tauri

yarn tauri build