Sudden libc linking issues on mac?

Earlier today I was building and running all my zig projects just fine, but suddenly (seriously, I didn’t touch Zig or my C toolchain in between it working and not working - maybe background updates did something?) it started outputting undefined symbol errors whenever any c library is involved.

Here’s a minimal example, running zig libc:

t@Ethans-MacBook-Pro-2 ~ % zig libc
error: undefined symbol: _bzero
    note: referenced by .cache/zig/o/c35083ea61b2b86f610610558ae42457/libc_zcu.o:_hash_map.HashMapUnmanaged([]const u8,[]const u8,process.EnvMap.EnvNameHashContext,80).grow
error: undefined symbol: _exit
    note: referenced by .cache/zig/o/c35083ea61b2b86f610610558ae42457/libc_zcu.o:_posix.exit
error: undefined symbol: _fcopyfile
    note: referenced by .cache/zig/o/c35083ea61b2b86f610610558ae42457/libc_zcu.o:_fs.File.Writer.sendFile
error: undefined symbol: _fork
    note: referenced by .cache/zig/o/c35083ea61b2b86f610610558ae42457/libc_zcu.o:_process.Child.run
error: undefined symbol: _getenv
    note: referenced by .cache/zig/o/c35083ea61b2b86f610610558ae42457/libc_zcu.o:_zig.LibCInstallation.findNative
    note: referenced by .cache/zig/o/c35083ea61b2b86f610610558ae42457/libc_zcu.o:_posix.execvpeZ_expandArg0__anon_67851
    note: referenced by .cache/zig/o/c35083ea61b2b86f610610558ae42457/libc_zcu.o:_posix.execvpeZ_expandArg0__anon_67853
error: undefined symbol: _sigaction
    note: referenced by .cache/zig/o/c35083ea61b2b86f610610558ae42457/libc_zcu.o:_main
error: undefined symbol: _sigemptyset
    note: referenced by .cache/zig/o/c35083ea61b2b86f610610558ae42457/libc_zcu.o:_main
error: undefined symbol: _sysctlbyname
    note: referenced by .cache/zig/o/c35083ea61b2b86f610610558ae42457/libc_zcu.o:_libc.main
error: undefined symbol: _waitpid
    note: referenced by .cache/zig/o/c35083ea61b2b86f610610558ae42457/libc_zcu.o:_process.Child.waitUnwrappedPosix

I’m on Zig 0.15.2, macOS 26.3.1 (a), Apple clang version 21.0.0 (clang-2100.0.123.102).

I’ve tried building different codebases, tried re-downloading Zig, deleting ~/.cache/zig, running xcode-select -–install and brew upgrade, using zig from an IDE instead of the command line, even rebooting!

Any clue what to do?

Zig Env output
t@Ethans-MacBook-Pro-2 ~ % zig env
.{
    .zig_exe = "/opt/homebrew/Cellar/zig/0.15.2/bin/zig",
    .lib_dir = "/opt/homebrew/Cellar/zig/0.15.2/lib/zig",
    .std_dir = "/opt/homebrew/Cellar/zig/0.15.2/lib/zig/std",
    .global_cache_dir = ".cache/zig",
    .version = "0.15.2",
    .target = "aarch64-macos.26.3.1...26.3.1-none",
    .env = .{
        .ZIG_GLOBAL_CACHE_DIR = null,
        .ZIG_LOCAL_CACHE_DIR = null,
        .ZIG_LIB_DIR = null,
        .ZIG_LIBC = null,
        .ZIG_BUILD_RUNNER = null,
        .ZIG_VERBOSE_LINK = null,
        .ZIG_VERBOSE_CC = null,
        .ZIG_BTRFS_WORKAROUND = null,
        .ZIG_DEBUG_CMD = null,
        .CC = null,
        .NO_COLOR = null,
        .CLICOLOR_FORCE = null,
        .XDG_CACHE_HOME = null,
        .HOME = "/Users/t",
    },
}

https://codeberg.org/ziglang/zig/issues/31658

Workarounds in the comments