TIDE
Languages

Zig

Installing Zig on Ubuntu in TIDE

Zig

Zig is a general-purpose programming language and toolchain designed for maintaining robust, optimal, and reusable software. Designed as a modern alternative to C, Zig offers explicit memory management, compile-time evaluation (comptime), zero hidden control flow, and native C compiler replacement capabilities.

Installation

Zig is distributed as a self-contained compiler toolchain with no external runtime dependencies.

Download the pre-compiled tarball release directly from ziglang.org:

apt update
apt install -y wget xz-utils

# Download and extract Zig 0.13.0 release
wget https://ziglang.org/download/0.13.0/zig-linux-x86_64-0.13.0.tar.xz
tar -xf zig-linux-x86_64-0.13.0.tar.xz

# Move to system directory and link binary
mv zig-linux-x86_64-0.13.0 /usr/local/zig
ln -sf /usr/local/zig/zig /usr/local/bin/zig

Option 2: Using ZVM (Zig Version Manager)

ZVM makes installing, switching, and updating Zig releases straightforward:

curl -sSL https://get.zvm.app | bash
source ~/.bashrc
zvm install 0.13.0

Option 3: Using Snap

On Ubuntu systems with snap installed:

snap install zig --classic --channel=latest/beta

Verification

Confirm that Zig is configured properly:

zig version

Writing and Running Code

Writing a Zig Program

Create a source file named hello.zig:

const std = @import("std");

pub fn main() !void {
    const stdout = std.io.getStdOut().writer();
    try stdout.print("Hello, World from Zig in TIDE!\n", .{});
}

Running with JIT Execution

Run the source code directly using the Zig CLI:

zig run hello.zig

Compiling to Binary

Build a standalone executable binary:

zig build-exe hello.zig
./hello

For release-optimized small binaries:

zig build-exe hello.zig -O ReleaseSmall
./hello

Using Zig as a C/C++ Compiler

Zig includes a drop-in C compiler supporting cross-compilation out of the box:

zig cc -o main main.c

Official Resources

On this page