Zig on this Mac
The installed toolchain is master, not a release: 0.18.0-dev.120+9fe22a29b
through zvm at /Users/donaldfilimon/.zvm/bin/zig. Measured 2026-10-10.
Read this before writing a line of Zig
Master has removed constructs that pretraining, tutorials, and Stack Overflow
all still teach. These are compiler errors, not warnings, and each was confirmed
by compiling on this machine:
| You will reach for | It gives | Use instead |
|---|
@cImport / @cInclude | invalid builtin function | zig translate-c, or b.addTranslateC |
@Type(...) | invalid builtin function | @Int, @Struct, @Enum, @Union, @Fn, @Pointer, @Tuple |
errdefer |err| | expected block or expression, found '|' | plain errdefer, destructure in a wrapper |
callconv(.C) | no member named 'C' | callconv(.c) |
std.heap.GeneralPurposeAllocator | no member named | std.heap.SafeAllocator |
std.io.getStdOut() | gone | Io.File.Writer off init.io |
std.fs.cwd() | no member named 'cwd' | Io.Dir.cwd() |
ArrayList(T).init(gpa) | gone | ArrayList is unmanaged; pass the allocator per call |
@typeInfo(S).Struct.fields | gone | .@"struct" with field_names / field_types |
std.meta.fields | @compileError | the parallel arrays above |
std.builtin is a deprecated alias for std.lang, and std.fs is a 21-line
shim. If a Zig answer feels familiar, that is a reason to check it, not to trust
it.
Two authorities, and they answer different questions
Compiling proves removal. The langref proves deprecation. @intFromEnum
compiles and passes today while ~/.zvm/master/doc/langref.html says
"Deprecated. Use @backingInt or @bitCast instead", so a green test is not
evidence a construct is current. The langref ships with the toolchain and its
version stamp matches zig version exactly. Read both.
Never answer a Zig question from memory. Read
/Users/donaldfilimon/.zvm/master/lib/std/, then compile the answer in
/private/tmp.
Where to go
- [[zig-toolchain]] first for anything environmental: which zig is active,
the dangling
~/.zvm/current symlink, the second zig on PATH, where the
langref and stdlib source live, scratch-path rules.
- [[zig-types]] for the type system: pointers, slices, sentinels, optionals,
error unions, structs, enums, unions, vectors, coercion, casting.
- [[zig-errors]] for error sets,
try, catch, errdefer, error return
traces, and when to use unreachable or assert instead of an error.
- [[zig-memory]] for allocators, ownership discipline, alignment, and the
leak-checked test pattern.
- [[zig-comptime]] for generics,
inline, @TypeOf, @typeInfo,
reflection, and the comptime failure modes.
- [[zig-builtins]] for the
@-builtin reference: 128 recognized, 126 usable.
- [[zig-std]] for the standard library map: containers,
fmt, mem, json,
http, crypto, math, sort, threads, time.
- [[zig-io]] for the
std.Io rewrite: readers, writers, buffering, printing
to stdout, and async under Io.Threaded. The most-changed surface; go here
before any I/O or concurrency work.
- [[zig-build]] for
build.zig, build.zig.zon, modules, steps,
dependencies, and cross-compilation.
- [[zig-testing]] for test blocks, filters,
std.testing, and fuzzing.
- [[zig-c-interop]] for
extern, export, the C ABI, linking, and using
zig cc as a cross compiler.
False greens seen on this toolchain
A --test-filter matching nothing prints All 0 tests passed and exits 0. A
leaking test prints OK on its own line and fails only in the summary. Zig
analysis is lazy, so a snippet nothing references can compile without being
checked: give every test an explicit driver. And cmd | tail reports tail's exit
status, not the command's, which has manufactured false green claims here before.
Projects using Zig here
Zig trees pin minimum_zig_version = "0.18.0-dev.120+9fe22a29b" (verified
2026-10-10): ~/dev/active/baseos, ~/dev/active/cell-lang, ~/dev/active/Gama,
~/dev/active/golive, ~/dev/active/Quesar.
~/dev/active/cell-lang is the Cell language compiler; read its AGENTS.md
first, and always build it with -Dswift=false.
-Dswift=false is cell-lang's flag, not a universal one. ~/dev/active/Gama's
current build.zig rejects it (error: invalid option: "swift"; the accepted
options are target, cpu, ofmt, dynamic-linker, optimize, mlir-opt),
so the older written instructions for Gama are stale. Read each project's
build.zig option list before passing any -D flag.