There are a few recommended ways to set up your workstation in order to develop gtk-rs applications. Let us go through them one by one.


Cargo is Rust's build system and package manager. If following the book is all you care about, using only Cargo will work fine for you.

Let us begin by installing all necessary tools. First follow the instructions on the GTK website in order to install GTK 4. Then install Rust with rustup.

Now create a new project by executing:

cargo new my-gtk-app

Add the following lines to your Cargo.toml.

version = "0.1"
package = "gtk4"

Now you can run your application by executing:

cargo run

Cargo + Meson

Cargo is nearly enough, but it is not well suited for handling resources such as icons or UI definition files. That is why we recommend to use Meson on top of it. It is cross-platform and its syntax is very readable. Meson takes care of

Here as well, you first follow the instructions on the GTK website in order to install GTK 4. Then install Rust with rustup. Finally, install Meson by following the instructions on the Meson website.

You can download a ready-to-use gtk-rust-template here. Follow the instructions in the README to initialize your own application. Then configure your project.

meson --prefix=/usr build

In order to compile and install it run the following commands. You have to execute it every time you modify your application.

ninja -C build && ninja -C build install

Now the application should be in a folder included in your system path. You can either start it with the application launcher of your choice or in the terminal.

Cargo + Meson + Flatpak

If you develop on Linux, using Flatpak is the most convenient option. With Flatpak your whole workflow is containerized and your users get the very same application you develop on (including all dependencies). First, assure that Flatpak is installed on your system, check this website to see if any steps are necessary on your distribution. Then download the gtk-rust-template and follow the instructions in its README.

Then either install:

That is it. The build dependencies can be downloaded by the IDE. With GNOME Builder, you only have to press the run button for that.