This section describes how to install GTK 4 into Linux distributions.
There are two ways to install GTK 4.
This is the easiest way to install. I’ve installed GTK 4 packages (version 4.14.2) on Ubuntu 24.04 LTS.
$ sudo apt install libgtk-4-dev
It is important to install the development files package (libgtk-4-dev). Otherwise, you can’t compile any GTK 4 based programs.
Fedora, Debian, Arch, Gentoo and OpenSUSE also have GTK 4 packages. See the website of your distribution for further information.
Package information for Arch, Debian/Ubuntu and Fedora is described in GTK website, Installing GTK from packages.
If you want to install a developing version of GTK 4, you need to build it from the source. See Compiling the GTK Libraries section in the GTK 4 API reference.
There are two ways: zip and git. Downloading a zip file is the
easiest way. However, if you use git and clone this repository, you can
easily update your local repository by git pull
command.
<> Code
. Then a
popup menu appears. Click on Download ZIP
menu.<> Code
.
Then a popup menu appears. The first section is Clone
with
three tabs. Click HTTPS
tab and click on the copy icon,
which is on the right of
https://github.com/ToshioCP/Gtk4-tutorial.git
.git clone
, Ctrl+Shift+V.
Then the line will be
git clone https://github.com/ToshioCP/Gtk4-tutorial.git
.
Press the enter key.Gtk4-tutorial
is created. It is the copy of
this repository.Examples are under the src
directory. For example, the
first example of the tutorial is pr1.c
and its pathname is
src/misc/pr1.c
. So you don’t need to type the example codes
by yourself.