This guide will walk you through installing Rust, Dioxus, necessary native dependencies, and fixing the infamous black screen bug on Linux.
β Prerequisites
Youβll need a Linux system (Ubuntu, Debian, Arch, etc.) and basic terminal knowledge.
1. π¦ Install Rust
Install Rust using rustup, the official toolchain installer:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh Then restart your shell or run:
source $HOME/.cargo/env
Confirm it works:
rustc --version cargo --version
2. π¦ Install System Dependencies
Dioxus desktop apps use GTK and other native libraries. These are not bundled, so you need to install them yourself.
On Debian/Ubuntu/Pop!_OS:
sudo apt update sudo apt install \ libgtk-3-dev \ libwebkit2gtk-4.1-dev \ libsoup-3.0-dev \ libxdo-dev \ build-essential \ pkg-config \ libssl-dev
If you hit more linker errors, read the message carefully and install the -dev package for the missing lib.
3. βοΈ Install Dioxus CLI
Install cargo-binstall so you can install Dioxus CLI tool.
curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
Dioxus has a CLI tool to streamline development:
cargo binstall dioxus-cli
Then verify:
dx --help
4. π§ͺ Create and Serve Your App
Start a new app:
dx new hot_dog cd hot_dog dx serve
5. π Fix: Black Screen in Dioxus Desktop
If your app launches but displays a black window, you're likely hitting a WebKit compositing bug on Linux.
Fix it with this environment variable in the main program loop:
//main.rs fn main() { std::env::set_var("WEBKIT_DISABLE_COMPOSITING_MODE", "1"); dioxus::launch(App); }
Or add it to your shell config:
echo 'export WEBKIT_DISABLE_COMPOSITING_MODE=1' >> ~/.bashrc source ~/.bashrc
β Done!
Youβre now set up to build performant, native-feeling desktop GUIs using Rust and Dioxus.
For more:
π https://dioxuslabs.com/guide/
Top comments (0)