How to install Zig
on Ubuntu



Jay Petacat (jayschwa)

Zig Programming Language

Zig is a general-purpose programming language designed for robustness, optimality, and maintainability.

Feature Highlights:

  • Small, simple language. Focus on debugging your application rather than debugging knowledge of your programming language.
  • Ships with a build system that obviates the need for a configure script or a makefile. In fact, existing C and C++ projects may choose to depend on Zig instead of e.g. cmake.
  • A fresh take on error handling which makes writing correct code easier than writing buggy code.
  • Debug mode optimizes for fast compilation time and crashing with a stack trace when undefined behavior would happen.
  • ReleaseFast mode produces heavily optimized code. What other projects call "Link Time Optimization" Zig does automatically.
  • Compatible with C libraries with no wrapper necessary. Directly include C .h files and get access to the functions and symbols therein.
  • Provides standard library which competes with the C standard library and is always compiled against statically in source form. Zig binaries do not depend on libc unless explicitly linked.
  • Optional type instead of null pointers.
  • Safe unions, tagged unions, and C ABI compatible unions.
  • Generics so that one can write efficient data structures that work for any data type.
  • No header files required. Top level declarations are entirely order-independent.
  • Compile-time code execution. Compile-time reflection.
  • Partial compile-time function evaluation which eliminates the need for a preprocessor or macros.
  • The binaries produced by Zig have complete debugging information so you can, for example, use GDB, MSVC, or LLDB to debug your software.
  • Built-in unit tests with zig test.
  • Friendly toward package maintainers. Reproducible build, bootstrapping process carefully documented. Issues filed by package maintainers are considered especially important.
  • Cross-compiling is a primary use case.
  • In addition to creating executables, creating a C library is a primary use case. You can export an auto-generated .h file.

Details for Zig

Last updated
30 September 2019

Enable snaps on Ubuntu and install Zig

Snaps are applications packaged with all their dependencies to run on all popular Linux distributions from a single build. They update automatically and roll back gracefully.

Snaps are discoverable and installable from the Snap Store, an app store with an audience of millions.

Enable snapd

If you’re running Ubuntu 16.04 LTS (Xenial Xerus) or later, including Ubuntu 18.04 LTS (Bionic Beaver), Ubuntu 18.10 (Cosmic Cuttlefish) and Ubuntu 19.04 (Disco Dingo), you don’t need to do anything. Snap is already installed and ready to go.

For versions of Ubuntu between 14.04 LTS (Trusty Tahr) and 15.10 (Wily Werewolf), as well as Ubuntu flavours that don’t include snap by default, snap can be installed from the Ubuntu Software Centre by searching for snapd.

Alternatively, snapd can be installed from the command line:

sudo apt update sudo apt install snapd

Either log out and back in again, or restart your system, to ensure snap’s paths are updated correctly.

Install Zig

To install Zig, simply use the following command:

Other popular snaps…

See more...
See more in Featured

More things to do…

Get the snap store

Browse and find snaps from the convenience of your desktop using the snap store snap.

Learn more about snaps

Interested to find out more about snaps? Want to publish your own application? Visit now.