Environment Setup
To develop a gtk-kn
application, you need:
- The Kotlin/Native toolchain, which requires a Java environment (only for Gradle, not the actual application)
- The GTK 4 library and dependencies
Most Linux distributions require only three essential packages to build and run GTK applications:
- pkgconf
- gobject-introspection (or libgirepository)
- libadwaita
However, if you’re missing additional dependencies or want to build the gtk-kn
itself,
you can use the installation scripts provided below.
Requirements by OS¶
Linux¶
The gtk-kn
project supports development on major Linux distributions. Our CI tests ensure
compatibility with the latest stable versions of:
- Arch Linux
- Fedora
- openSUSE Tumbleweed
- Ubuntu LTS
For most distributions, installing these three packages is enough:
sudo apt install pkgconf libgirepository1.0-dev libadwaita-1-dev # Ubuntu/Debian
sudo dnf install pkgconf gobject-introspection-devel libadwaita-devel # Fedora
sudo pacman -S pkgconf gobject-introspection libadwaita # Arch Linux
sudo zypper install pkgconf gobject-introspection-devel libadwaita-devel # openSUSE
If you’re missing dependencies or need to build the gtk-kn
itself, use these scripts:
Arch Linux¶
# Update the system and package lists
pacman -Syu --noconfirm
# Install packages without prompts
pacman -S --noconfirm \
git \
libxcrypt-compat \
pkgconf \
jdk17-openjdk \
python-pip \
gcc-multilib \
glib2 \
gobject-introspection \
libadwaita \
gtksourceview5 \
webkitgtk-6.0
# Clean up package cache to reduce image size
pacman -Scc --noconfirm
Fedora¶
# Update package lists
dnf check-update || true
# Install packages without prompts
dnf install -y \
git \
libxcrypt-compat \
java-17-openjdk-devel \
python3-pip \
gcc \
glib2-devel \
gobject-introspection-devel \
libadwaita-devel \
gtksourceview5-devel \
webkitgtk6.0-devel
# Clean up package lists to reduce image size
dnf clean all
openSUSE Tumbleweed¶
# Update package lists
zypper refresh
# Install packages without prompts
zypper install -y \
git \
java-17-openjdk-devel \
python3-pip \
gcc \
glib2-devel \
gobject-introspection-devel \
libadwaita-devel \
gtksourceview5-devel \
webkit2gtk4-devel
# Clean up package lists to reduce image size
zypper clean --all
Ubuntu LTS¶
# Update package lists
apt-get update
# Install packages without prompts
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
git \
apt-utils \
openjdk-17-jdk-headless \
python3-pip \
gcc-multilib \
libgirepository1.0-dev \
libadwaita-1-dev \
libgtksourceview-5-dev \
libwebkitgtk-6.0-dev
# Clean up package lists
apt-get clean
macOS (Apple Silicon Only)¶
gtk-kn
now supports macOS on Apple Silicon (arm64). To get started:
-
Install Xcode: Ensure Xcode is installed manually via the Mac App Store or from the Apple Developer website. Xcode is required to provide essential build tools.
-
Install Dependencies: Use the following script to set up additional dependencies:
# Check if Xcode is installed
if ! /usr/bin/xcrun xcodebuild -version &> /dev/null
then
echo "Xcode is not installed or the license has not been accepted. Please install Xcode and accept the license to proceed."
exit 1
fi
# Check if Homebrew is installed, install if missing
if ! command -v brew &> /dev/null
then
echo "Homebrew not found. Installing..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
# Update Homebrew
brew update
# Install packages
brew install \
openjdk@17 \
pkgconf \
gobject-introspection \
gtk4 \
libadwaita \
gtksourceview5
Windows¶
Windows Support Planned
Windows support is planned, enabling developers to create cross-platform GUI applications that run on Linux, macOS, and Windows.
Editor or Integrated Development Environment (IDE)¶
While any editor that supports Kotlin can be used, we recommend using IntelliJ IDEA for the best development experience.
Next Steps¶
Once your development environment is set up, you’re ready to create your first gtk-kn
application.
👉 Follow the Get Started guide for step-by-step instructions on setting up a Hello World GTK project using Kotlin/Native.