Zig is a general-purpose programming language and toolchain designed for maintaining robust, optimal, and reusable software. While Zig is gaining popularity among developers for its performance and safety features, installing it on Debian systems can be challenging since it’s not available in the official Debian repositories.
Fortunately, there’s an easier way: using the unofficial debian.griffo.io
repository, which provides pre-built Debian packages for Zig and many other useful development tools.
The debian.griffo.io
repository offers several advantages over manual installation:
Before we begin, make sure you have:
sudo
privilegescurl
installed (install with sudo apt install curl
if needed)First, we need to add the GPG key and repository to your system. Run the following commands in your terminal:
# Add the GPG key
curl -sS https://debian.griffo.io/EA0F721D231FDD3A0A17B9AC7808B4DD62C41256.asc | sudo gpg --dearmor --yes -o /etc/apt/trusted.gpg.d/debian.griffo.io.gpg
# Add the repository
echo "deb https://debian.griffo.io/apt $(lsb_release -sc 2>/dev/null) main" | sudo tee /etc/apt/sources.list.d/debian.griffo.io.list
Let’s break down what these commands do:
After adding the repository, update your package lists:
sudo apt update
Now you can install Zig using APT. The repository provides multiple options and allows you to install different versions simultaneously:
The repository uses a smart packaging approach:
zig
- A metapackage that points to zig-0
(the stable release)zig-0
- The actual stable Zig packagezig-master
- Weekly builds from the master branch (cutting-edge features)This design allows you to install multiple versions of Zig side by side without conflicts.
For the stable release of Zig:
sudo apt install zig
This installs the zig
metapackage, which automatically pulls in zig-0
(the stable version).
For the latest weekly builds from the master branch:
sudo apt install zig-master
You can install both stable and weekly builds simultaneously:
sudo apt install zig zig-master
This gives you access to both versions on the same system. The system uses Debian’s update-alternatives
mechanism to manage which version is active when you run the zig
command, allowing you to:
After installation, verify that Zig is working correctly:
zig version
You should see output similar to:
0.14.1
Or if you have the weekly build active:
0.14.0-dev.1911+3bf89f55c
When you have both versions installed, Debian’s update-alternatives
system manages which version is active when you run the zig
command.
To see which Zig versions are available and which one is currently active:
update-alternatives --config zig
This will show output similar to:
There are 2 choices for the alternative zig (providing /usr/bin/zig).
Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/lib/zig/0.14.1/zig 100 auto mode
1 /usr/lib/zig/0.14.1/zig 100 manual mode
2 /usr/lib/zig/master/zig 50 manual mode
Press <enter> to keep the current choice[*], or type selection number:
To switch to a different version, run the command above and enter the selection number for your desired version. For example, entering 2
would switch to the weekly build.
The repository also provides ZLS, the Language Server Protocol implementation for Zig, which enables IDE features in your editor. Like Zig, ZLS follows the same versioning pattern and uses update-alternatives
:
sudo apt install zls
This installs ZLS that works with the stable Zig version.
sudo apt install zls-master
This installs ZLS that works with the weekly Zig builds.
You can install both versions to match your Zig installations:
sudo apt install zls zls-master
Like Zig, ZLS uses update-alternatives
to manage multiple versions:
# Check available ZLS versions
update-alternatives --config zls
# Switch to stable ZLS
sudo update-alternatives --config zls
This ensures you have the appropriate language server for whichever Zig version you’re currently using.
One of the biggest advantages of using the repository is easy updates. To update Zig (and all other packages):
sudo apt update && sudo apt upgrade
The debian.griffo.io
repository doesn’t just provide Zig. It also includes many other useful development tools:
If you encounter GPG key issues, make sure you’re using the correct key. The repository updated its public key on March 4th, 2025, so older installations might need to update:
# Remove old key if it exists
sudo rm -f /etc/apt/trusted.gpg.d/debian.griffo.io.gpg
# Add the new key
curl -sS https://debian.griffo.io/EA0F721D231FDD3A0A17B9AC7808B4DD62C41256.asc | sudo gpg --dearmor --yes -o /etc/apt/trusted.gpg.d/debian.griffo.io.gpg
If APT can’t find the Zig package:
sudo apt update
after adding the repositorycat /etc/apt/sources.list.d/debian.griffo.io.list
If you need to remove Zig, you have several options depending on what you want to remove:
# Remove stable Zig (metapackage)
sudo apt remove zig
# Remove the actual stable package
sudo apt remove zig-0
# Remove weekly builds
sudo apt remove zig-master
# Remove all Zig versions
sudo apt remove zig zig-0 zig-master
# Remove stable ZLS
sudo apt remove zls
# Remove weekly ZLS
sudo apt remove zls-master
# Remove all ZLS versions
sudo apt remove zls zls-master
If you want to completely remove the repository:
sudo rm /etc/apt/sources.list.d/debian.griffo.io.list
sudo rm /etc/apt/trusted.gpg.d/debian.griffo.io.gpg
sudo apt update
Now that Zig is installed, let’s create a simple “Hello, World!” program:
# Create a new file
echo 'const std = @import("std");
pub fn main() void {
std.debug.print("Hello, World!\\n", .{});
}' > hello.zig
You can test your program by switching between versions:
# Compile and run with current active version
zig run hello.zig
# Switch to weekly build and run
sudo update-alternatives --set zig /usr/bin/zig-master
zig run hello.zig
# Switch back to stable and run
sudo update-alternatives --set zig /usr/bin/zig-0.14.1
zig run hello.zig
All versions should output:
Hello, World!
For larger projects, you can switch versions as needed:
# Create a project directory
mkdir my-project
cd my-project
# Use stable Zig for this project
sudo update-alternatives --set zig /usr/bin/zig-0.14.1
zig init-exe
# Later, switch to weekly build to test new features
sudo update-alternatives --set zig /usr/bin/zig-master
zig build
Installing Zig on Debian doesn’t have to be complicated. The debian.griffo.io
repository provides an easy, maintainable way to install and keep Zig up-to-date on your Debian system. The smart packaging approach with metapackages and update-alternatives
allows you to:
update-alternatives --config zig
zig
command regardless of which version is activeWhether you need the stable release for production work or the weekly builds for experimenting with the latest features, this repository has you covered. The update-alternatives
system makes it seamless to switch between versions, perfect for developers who want to stay current with Zig’s development while maintaining stability for their projects.
The repository is maintained as an unofficial community project and provides packages that aren’t available in the official Debian repositories. It’s a valuable resource for Debian users who want access to modern development tools without the hassle of manual compilation and installation.
If you’re working with Python projects, you might also be interested in our guide on How to Install uv on Debian, which covers installing the extremely fast Python package manager using the same repository and installation process.
Happy coding with Zig!
Disclaimer: The debian.griffo.io repository is an unofficial community project and is not affiliated with the official Debian project or the Zig programming language team.