Setting Up Linux
1. System Dependencies​
You will need to install a couple of system dependencies, such as a C compiler and webkit2gtk
for desktop development. Below are commands for a few popular distributions:
- Debian
- Arch
- Fedora
- openSUSE
- NixOS
sudo apt update
sudo apt install libwebkit2gtk-4.1-dev \
build-essential \
curl \
wget \
libssl-dev \
libgtk-3-dev \
libayatana-appindicator3-dev \
librsvg2-dev
sudo pacman -Syu
sudo pacman -S --needed \
webkit2gtk-4.1 \
base-devel \
curl \
wget \
openssl \
appmenu-gtk-module \
gtk3 \
libappindicator-gtk3 \
librsvg \
libvips
sudo dnf check-update
sudo dnf install webkit2gtk4.1-devel \
openssl-devel \
curl \
wget \
libappindicator-gtk3 \
librsvg2-devel
sudo dnf group install "C Development Tools and Libraries"
Note that on Fedora 36 and below the webkit2gtk4.0-devel
package was called webkit2gtk3-devel
.
sudo zypper up
sudo zypper in webkit2gtk3-devel \
libopenssl-devel \
curl \
wget \
libappindicator3-1 \
librsvg-devel
sudo zypper in -t pattern devel_basis
Working on NixOS requires a slightly different setup, as Tauri needs to find the required system libraries both at compile time and
dynamically at runtime. To make them available to Tauri the LD_LIBRARY_PATH
environment variable needs to be populated with the correct paths.
When using Nix Flakes, copy the following code into flake.nix
on your repository, then run nix develop
to activate the development environment. You can also use direnv's Flakes integration to automatically start the dev shell when entering the project folder.
{
inputs = {
nixpkgs.url = "nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
libraries = with pkgs;[
webkitgtk
gtk3
cairo
gdk-pixbuf
glib
dbus
openssl_3
];
packages = with pkgs; [
curl
wget
pkg-config
dbus
openssl_3
glib
gtk3
libsoup
webkitgtk
librsvg
];
in
{
devShell = pkgs.mkShell {
buildInputs = packages;
shellHook =
''
export LD_LIBRARY_PATH=${pkgs.lib.makeLibraryPath libraries}:$LD_LIBRARY_PATH
'';
};
});
}
If you don't use Nix Flakes, the Nix Shell can be configured using the following shell.nix
script. Run nix-shell
to activate the development environment, or use direnv's Shell integration to automatically start the dev shell when entering the project folder.
let
pkgs = import <nixpkgs> { };
libraries = with pkgs;[
webkitgtk
gtk3
cairo
gdk-pixbuf
glib
dbus
openssl_3
];
packages = with pkgs; [
pkg-config
dbus
openssl_3
glib
gtk3
libsoup
webkitgtk
appimagekit
librsvg
];
in
pkgs.mkShell {
buildInputs = packages;
shellHook =
''
export LD_LIBRARY_PATH=${pkgs.lib.makeLibraryPath libraries}:$LD_LIBRARY_PATH
'';
}
2. Rust​
To install Rust on Linux, open a terminal and enter the following command:
curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sh
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
The command downloads a script and starts the installation of the rustup
tool, which installs the latest stable version of Rust. You might be prompted for your password. If the installation was successful, the following line will appear:
Rust is installed now. Great!
Make sure to restart your Terminal for the changes to take effect.
Android​
First, make sure to install the required rust android targets:
rustup target add aarch64-linux-android armv7-linux-androideabi i686-linux-android x86_64-linux-android
To set up your Linux machine for Android development you need to download and install Android Studio from the official website.
1. Configure JDK​
Android Studio includes a JDK so you do not need to download a separate one. Set the JAVA_HOME
environment variable to the location of the JDK:
export JAVA_HOME=/opt/android-studio/jbr
Note that on older Android Studio installations the jbr
directory may still be called jre
.
2. Install the Android SDK and NDK​
You can use the SDK Manager in Android Studio to install:
- Android SDK Platform
- Android SDK Platform-Tools
- NDK (Side by side)
- Android SDK Build-Tools
- Android SDK Command-line Tools
You may need to tick Show Package Details
in the bottom right corner to be able to see some of these components.
Now you need to set the ANDROID_HOME
and NDK_HOME
environment variables:
export ANDROID_HOME="$HOME/Android/Sdk"
export NDK_HOME="$ANDROID_HOME/ndk/25.0.8775105"
Note that the path might be slightly different based on the version of NDK you installed.
Managing The Rust Installation​
You should keep your Rust version up to date whenever possible to always benefit from the latest improvements. To update Rust, open a terminal and run the following command:
rustup update
rustup
can also be used to uninstall Rust from your machine fully:
rustup self uninstall
Troubleshooting​
To check whether you have Rust installed correctly, open a shell and enter this command:
rustc --version
You should see the version number, commit hash, and commit date for the latest stable version that has been released in the following format:
rustc x.y.z (abcabcabc yyyy-mm-dd)
If you don't see this information, your Rust installation might be broken. Please consult Rust's Troubleshooting Section on how to fix this. If your problems persist, you can get help from the official Tauri Discord and GitHub Discussions.