My personal notes for building zig 0.12.0-dev.xxxx on an M2 Max.
This setup should work on any M1 or M2 Mac, but you must check other models yourself. Currently it also works on an Intel Mac, with one small difference: homebrew has a different default path there.
DO YOU REALLY NEED TO BUILD FROM SOURCE?
"First of all, if your goal is to install a specific version of Zig, you can find pre-built tarballs on the download page. You could also try installing Zig from a package manager. Finally, there is zig-bootstrap to cross-compile an installation of Zig from source for any target. When using zig-bootstrap, be sure to check out the git tag corresponding to the version you want to build, as master branch is not kept in any coherent state."