Skip to content

Latest commit

 

History

History
314 lines (216 loc) · 8.09 KB

File metadata and controls

314 lines (216 loc) · 8.09 KB
title
Prerequisites

import { Tabs, TabItem, Card } from '@astrojs/starlight/components';

In order to get started building your project with Tauri you'll first need to install a few dependencies:

  1. System Dependencies
  2. Rust
  3. Configure for Mobile Targets (only required if developing for mobile)

System Dependencies

Follow the link to get started for your respective operating system:

Linux

Tauri requires various system dependencies for development on Linux. These may be different depending on your distribution but we've included some popular distributions below to help you get setup.

{/* Note: These are the officially supported linux distributions. /} {/ If you wish to add another please open an issue to discuss prior to opening a PR */}

sudo apt update
sudo apt install libwebkit2gtk-4.0-dev \
  build-essential \
  curl \
  wget \
  file \
  libssl-dev \
  libgtk-3-dev \
  libayatana-appindicator3-dev \
  librsvg2-dev
sudo pacman -Syu
sudo pacman -S --needed \
  webkit2gtk \
  base-devel \
  curl \
  wget \
  file \
  openssl \
  appmenu-gtk-module \
  gtk3 \
  libappindicator-gtk3 \
  librsvg \
  libvips
sudo dnf check-update
sudo dnf install webkit2gtk4.0-devel \
  openssl-devel \
  curl \
  wget \
  file \
  libappindicator-gtk3-devel \
  librsvg2-devel
sudo dnf group install "C Development Tools and Libraries"
sudo emerge --ask \
  net-libs/webkit-gtk:4 \
  dev-libs/libappindicator \
  net-misc/curl \
  net-misc/wget \
  sys-apps/file
sudo zypper up
sudo zypper in webkit2gtk3-soup2-devel \
  libopenssl-devel \
  curl \
  wget \
  file \
  libappindicator3-1 \
  librsvg-devel
sudo zypper in -t pattern devel_basis

TODO: Need to build this out

If your distribution isn't included above then you may want to check Awesome Tauri on GitHub to see if a guide has been created.

Next: Install Rust

macOS

Tauri uses Xcode various macOS and iOS development dependencies.

Download and install Xcode from one of the following places:

{/* TODO: Do you need to launch Xcode for everything to get set up correctly before continuing? */}

Only developing for desktop targets? If you're only planning to develop desktop apps and not targetting iOS then you can install Xcode Command Line Tools instead:
xcode-select --install

Next: Install Rust

Windows

Tauri uses the Microsoft C++ Build Tools for development as well as Microsoft Edge WebView2. These are both required for development on Windows.

Follow the steps below to install the required dependecies.

Microsoft C++ Build Tools

  1. Download the Microsoft C++ Build Tools installer and open it to begin installation.
  2. During installation check the "Desktop development with C++" option.

Visual Studio C++ Build Tools installer screenshot

Next: Install WebView2.

WebView2

:::tip WebView 2 is already installed on Windows 10 (from version 1803 onward) and later versions of Windows. If you are developing on one of these versions then you can skip this step and go directly to installing Rust. :::

Tauri uses Microsoft Edge WebView2 to render content on Windows.

Install WebView2 by visiting the WebView2 Runtime download section. Download the "Evergreen Boostrapper" and install it.

Next: Install Rust

Rust

Tauri is built with Rust and requires it for development. Install Rust using one of following methods. You can view more installation methods at https://www.rust-lang.org/tools/install.

Install via rustup using the following command:

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

:::tip[Security Tip] We have audited this bash script, and it does what it says it is supposed to do. Nevertheless, before blindly curl-bashing a script, it is always wise to look at it first.

Here is the file as a plain script: rustup.sh :::

Visit https://www.rust-lang.org/tools/install to install rustup.

Be sure to restart your Terminal (and in some cases your system) for the changes to take affect.

Next: Configure for Mobile Targets if you'd like to build for Android and iOS. Otherwise Create a Project.

Configure for Mobile Targets

If you'd like to target your app for Android or iOS then there are a few additional dependencies that you need to install:

Android

  1. Download and install Android Studio from the Android Developers website
  2. Set the JAVA_HOME environment variable:

{/* TODO: Can this be done in the 4th step? */}

export JAVA_HOME=/opt/android-studio/jbr
export JAVA_HOME="/Applications/Android Studio.app/Contents/jbr/Contents/Home"
[System.Environment]::SetEnvironmentVariable("JAVA_HOME", "C:\Program Files\Android\Android Studio\jbr", "User")
3. Use the SDK Manager in Android Studio to install the following:
  • Android SDK Platform
  • Android SDK Platform-Tools
  • NDK (Side by side)
  • Android SDK Build-Tools
  • Android SDK Command-line Tools
  1. Set ANDROID_HOME and NDK_HOME environment variables

{/* TODO: Does the version number change below? */}

export ANDROID_HOME="$HOME/Library/Android/sdk"
export NDK_HOME="$ANDROID_HOME/ndk/25.0.8775105"

{/* TODO: Do we need a note about this version? */}

[System.Environment]::SetEnvironmentVariable("ANDROID_HOME", "$env:LocalAppData\Android\Sdk", "User")
[System.Environment]::SetEnvironmentVariable("NDK_HOME", "$env:LocalAppData\Android\Sdk\ndk\25.0.8775105", "User")
  1. Add the Android targets with rustup:
rustup target add aarch64-linux-android armv7-linux-androideabi i686-linux-android x86_64-linux-android
rustup target add aarch64-linux-android armv7-linux-androideabi i686-linux-android x86_64-linux-android

Next: Setup for iOS or Create a project.

iOS

:::caution[macOS Only] iOS development requires Xcode and is only available on macOS. :::

Add the iOS targets with rustup in Terminal:

rustup target add aarch64-apple-ios x86_64-apple-ios aarch64-apple-ios-sim

Be sure that you've installed Xcode and not Xcode Command Line Tools in the macOS system dependencies section.

Next: Create a project.

Troubleshooting

If you run into any issues during installation be sure to check the Troubleshooting Guide or reach out on the Tauri Discord.

Now that you've installed all of the prerequisistes you're ready to create your first Tauri project!