Zig is an [[MIT License]] licensed self-hosted compiled programming language bootstrapped in [[C++]].
- [Website](https://ziglang.org)
- [Source](https://github.com/ziglang/zig)
- [Documentation](https://ziglang.org/learn/)
- [Wikipedia](https://en.wikipedia.org/wiki/Zig_(programming_language))
> Zig is a general-purpose programming language and toolchain for maintaining **robust**, **optimal** and **reusable** software.
\- official website
# Notability
It is a C-like curly brackets and semicolons language so I never paid much attention to it.
However, as a C compiler with cross compilation features it is interesting.
The language as a concept appeals to me. It was originally designed to write a [[Digital Audio Workstation|DAW]].
# Philosophy
Operates in a similar space as [[Nim]], [[Rust]], [[V]], [[Carbon]], and other post-millennial languages looking to supplant C.
## Dependencies
Originally developed in [[C++]] targeting [[LLVM]].
Now it is self-hosting and [[LLVM]] can be disabled from being part of the build pipeline.
## Anti-Slop
Zig's contribution guidelines have a strict no [[LLM]] policy.
In late 2025, Zig announced a move from [[GitHub]] to [[Codeberg]]. Citing bugs, bloat, and [[Github Copilot]] among the reasons for leaving.[^1]
## Vs Other Language Devs
See [[V#Pre-Release Controversy]].
# Platform Support
Zig has a *massive* table of supported combined-arch-and-OS targets[^3] broken down into tiers, which I won't replicate here. This is just a list of separate architectures and OSes.
## Architectures
Architectures in Zig's Tier 1 & 2 list:
- [[AMD64]]
- [[ARM64]]
- [[ARM]]
- [[Hexagon (ISA)]]
- [[MIPS64]]
- [[MIPS]]
- [[LoongArch64]]
- [[POWERPC64]]
- [[POWERPC]]
- [[RISC-V|RISC-V 64]]
- [[RISC-V|RISC-V 32]]
- [[s390x]]
- [[WASM|WASM 32]]
- [[Thumb]]
## Operating Systems
### Official Packages
Operating systems listed among Zig's official packages, this covers all OSes from the Tier 1 and Tier 2 list:
- [[Linux]]
- [[FreeBSD]]
- [[OpenBSD]]
- [[NetBSD]]
- [[macOS]] / `maccatalyst`
- [[Windows]]
### Other Supported Operating Systems
Operating Systems in Zig's Tier 3 list:
- [[Haiku]]
- [[iOS]] / [[tvOS]] / [[visionOS]] / [[watchOS]]
- [[Serenity OS]]
- [[Illumos]]
- [[DragonFly BSD]]
## Dropped Support
> In general, the Zig project cannot support proprietary operating systems that make it unreasonably difficult to obtain system headers and thus audit contributions.
\- Target Support section of documentation[^2]
- [[Solaris]]
- IBM [[AIX]]
- IBM z/O
## Other
I see a *lot* of mentions of [[Haiku]] in the source but I don't see Zig in Haiku's software depot.
# Features
Ships with its own [[C|C]] and C++ compilers in addition to the Zig compier itself.
Cross-compilation is a first-class feature, so any program can be compiled for any of its support platforms regardless of host.
This alone makes it very powerful for [[C]] programmers.
# Tips
## Dependency Management
Between the `build.zig` and `build.zig.zon`. The `zon` file stores the package metadata.
```sh
zig fetch --save url
```
## Zig Version Manager
```cardlink
url: https://github.com/marler8997/anyzig
title: "GitHub - marler8997/anyzig: One zig to rule them all."
description: "One zig to rule them all. Contribute to marler8997/anyzig development by creating an account on GitHub."
host: github.com
favicon: https://github.githubassets.com/favicons/favicon.svg
image: https://opengraph.githubassets.com/edb07beeba1a3faf0235146aa1007bfbf814356c7b93344515a16ff4472619c2/marler8997/anyzig
```
## Zig C Cross-Compiler
```cardlink
url: https://zig.news/kristoff/cross-compile-a-c-c-project-with-zig-3599
title: "Cross-compile a C/C++ Project with Zig"
description: "Zig is not just a programming language but also a toolchain that can help you maintain and gradually..."
host: zig.news
favicon: https://zig.news/images/Vg4_Qzp5ZVNPyVuywhHDTVA_FhYBjyX_IZG8iMEeweU/rt:fit/w:32/g:sm/mb:500000/ar:1/aHR0cHM6Ly96aWcu/bmV3cy91cGxvYWRz/L2FydGljbGVzL3pr/YWVtbzNuMDJjYW13/bWwzYXJjLnBuZw
image: https://zig.news/images/dvp2uuSOnkjMdnK6OBEOKbqhI29utWFw1iXvt9mAkbc/rs:fill:1000:500/g:sm/mb:500000/ar:1/aHR0cHM6Ly96aWcu/bmV3cy91cGxvYWRz/L2FydGljbGVzL2p4/ZGJyMWI2MTd6MXZv/ZnptZjNxLnBuZw
```
```cardlink
url: https://andrewkelley.me/post/zig-cc-powerful-drop-in-replacement-gcc-clang.html
title: "`zig cc`: a Powerful Drop-In Replacement for GCC/Clang - Andrew Kelley"
host: andrewkelley.me
```
# Resources
- [Zig News Site](https://zig.news)
- [Zigmod Package Manager](https://github.com/nektro/zigmod)
- https://gencmurat.com/en/posts/zig-strings/
## Videos
```cardlink
url: https://youtu.be/5I4ZkmMS4-0
title: "Zig for Impatient Devs"
description: "Discord (!!!): https://discordapp.com/invite/bWrctJ7C is a great language. It's fast, simple, and oh so dangerous. But what if you want the speed, but not th..."
host: youtu.be
favicon: https://www.youtube.com/s/desktop/28b0985e/img/favicon_32x32.png
image: https://i.ytimg.com/vi/5I4ZkmMS4-0/maxresdefault.jpg
```
```cardlink
url: https://youtu.be/iqddnwKF8HQ
title: "Zig 2026: No-AI Policy, $670K Foundation, Left GitHub & Why Zig Isn’t 1.0 - Andrew Kelley Explains"
description: "Andrew Kelley quit his job in 2018 to build a programming language. Eight years later, Zig powers Ghostty, TigerBeetle and Uber's cross-compilation. It's top..."
host: youtu.be
favicon: https://www.youtube.com/s/desktop/61baa440/img/favicon_32x32.png
image: https://i.ytimg.com/vi/iqddnwKF8HQ/maxresdefault.jpg
```
## Programs Written in Zig
```base
filters:
and:
- note["proglang"].contains(link("Zig"))
properties:
note.proglang:
displayName: ProgLang
note.tags:
displayName: Tags
file.name:
displayName: Name
views:
- type: table
name: Table
order:
- file.name
- proglang
- tags
```
# References
[^1]: https://ziglang.org/news/migrating-from-github-to-codeberg/
[^2]: https://ziglang.org/download/0.16.0/release-notes.html#Target-Support
[^3]: https://ziglang.org/download/0.16.0/release-notes.html#Support-Table