Hi! If you've got here, maybe you had the same journey that I did: follow the instuctions on the Zig website for installing on macOS, only to discover that most Zig tutorials (like Ziglings) don't support the latest stable version, but usually something closer to bleeding edge.
Well... this is what I did, and hopefully it helps.
-
Head on over to the Zig download page and downloadt the appropriate file. If you're on an M-series processor, that is the
aarch64
, otherisex86_64
. -
I have put my binary in my user's home folder, at
~/bin
. You might have to create thebin
folder if you don't already have one.tar -xzf ~/Downloads/zig-macos-aarch64-<version>.tar.xz -C ~/bin
-
This is optional, but it makes things easier in the future, such as for updating.
ln -s ~/bin/zig-macos-aarch64-<version>/zig ~/bin/zig
-
If you chose to put your zig executable in the
~/bin
folder, and you have not already added that folder to your path, you will need to do that.echo 'export PATH=$PATH:~/bin' >> ~/.zshrc
then, apply the changes to your
.zshrc
to the current shell.source ~/.zshrc
-
You should now be able to use Zig from your terminal:
zig version