Skip to main content

Set Up Your Environment

In this guide, you'll learn how to set up your environment, so that you can build and run React Native desktop apps on your own machine. A desktop app is a regular native executable for the operating system you develop on: you build macOS apps on a Mac, Windows apps on Windows, and Linux apps on Linux.

info

The first build of an app compiles the Rust renderer and takes a few minutes. Later builds are incremental. If the toolchain below is already installed, you should be up and running within a few minutes. Otherwise, expect about half an hour to install the compilers.

Development OS​

Installing dependencies​

You will need Node, Rust, CMake, a C++ compiler and a few development packages.

React Native needs Node.js 22.13 or newer, and the desktop renderer is written in Rust, so you need a stable Rust toolchain installed with rustup.

System packages​

Install the compiler, CMake, pkg-config, Perl and the X keyboard and XCB development libraries with your distribution's package manager:

sudo apt install build-essential cmake pkg-config perl \
libxkbcommon-dev libxkbcommon-x11-dev libxcb1-dev

Node and Rust​

Install Node.js 22.13 or newer. Your distribution's package may be older, so we recommend nvm or the NodeSource packages:

nvm install 22

Install Rust with rustup:

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

Restart your terminal afterwards so that cargo is on your PATH.

Verifying your setup​

Open a new terminal and run the doctor:

npx @react-native-gpui/cli doctor

It checks every tool on this page and prints how to fix each one that is missing or misconfigured:

Text
Desktop development on Linux
✓ Node.js 22.20.0
✓ Rust 1.96.0
✓ Cargo 1.96.0
✓ CMake 3.28.3
✓ C++ compiler 13.2.0
✓ pkg-config 1.8.1
✓ Perl 5.38.2
✓ xkbcommon development files 1.6.0
✖ xkbcommon-x11 development files: pkg-config cannot find xkbcommon-x11
Fix: Debian/Ubuntu: sudo apt install libxkbcommon-x11-dev, Fedora: sudo dnf install libxkbcommon-x11-devel, Arch: sudo pacman -S libxkbcommon-x11
✓ xcb development files 1.15

1 problem found.

Inside a React Native project, npx react-native doctor-desktop runs the same checks, and npx react-native doctor lists them in a Desktop section next to its own.

Troubleshooting​

  • Package xkbcommon-x11 was not found: install libxkbcommon-x11-dev (Debian / Ubuntu), libxkbcommon-x11-devel (Fedora) or libxkbcommon-x11 (Arch).
  • cargo: command not found: restart the terminal, or run . "$HOME/.cargo/env".
  • Node is too old: node --version reports less than 22.13. Install a newer Node with nvm.

Next steps​

Your environment is ready. Continue with Get Started to create and run your first app.