← Back toLearn

Getting Started

Tagged release or development build?

In general, tagged releases are more practical for projects that have dependencies and benefit from stability, while development builds are for people who want to help participate in the development of the Zig project.

Zig installations are self-contained archives that can be placed anywhere in your system. Multiple versions of Zig coexist without issue.

Installing Zig

Direct download

This is the most straight-forward way of obtaining Zig: grab a Zig bundle for your platform from theDownloads page, extract it in a directory and add it to yourPATH to be able to callzig from any location.

Setting up PATH on Windows

To setup your path on Windows runone of the following snippets of code in a Powershell instance. Choose if you want to apply this change on a system-wide level (requires running Powershell with admin privileges) or just for your user, andmake sure to change the snippet to point at the location where your copy of Zig lies. The; beforeC: is not a typo.

System wide (admin Powershell):

[Environment]::SetEnvironmentVariable(   "Path",   [Environment]::GetEnvironmentVariable("Path", "Machine") + ";C:\your-path\zig-windows-x86_64-your-version",   "Machine")

User level (Powershell):

[Environment]::SetEnvironmentVariable(   "Path",   [Environment]::GetEnvironmentVariable("Path", "User") + ";C:\your-path\zig-windows-x86_64-your-version",   "User")

After you’re done, restart your Powershell instance.

Setting up PATH on Linux, macOS, BSD

Add the location of your zig binary to your PATH environment variable.

This is generally done by adding an export line to your shell startup script (.profile,.zshrc, …)

exportPATH=$PATH:~/path/to/zig

After you’re done, eithersource your startup file or restart your shell.

Package managers

Windows

WinGet
Zig is available onWinGet.

winget install -e --id zig.zig

Chocolatey
Zig is available onChocolatey.

choco install zig

Scoop
Zig is available onScoop.

scoop install zig

Latestdev build:

scoop bucket add versionsscoop install versions/zig-dev

macOS

Homebrew
Latest tagged release:

brew install zig

MacPorts

sudo port install zig

Linux

Zig is also present in many package managers for Linux.

Building from source

SeeREADME.md.

Recommended tools

Syntax Highlighters and LSP

All major text editors have syntax highlight support for Zig. Some bundle it, some others require installing a plugin.

If you’re interested in a deeper integration between Zig and your editor, checkoutzigtools/zls.

If you’re interested in what else is available, checkout theTools section.

Run Hello World

If you completed the installation process correctly, you should now be able to invoke the Zig compiler from your shell.
Let’s test this by creating your first Zig program!

Navigate to your projects directory and run:

mkdirhello-worldcdhello-worldziginit

This should output:

info: created build.ziginfo: created build.zig.zoninfo: created src/main.ziginfo: created src/root.ziginfo: see `zig build --help` for a menu of options

Runningzig build run should then compile the executable and run it, ultimately resulting in:

All your codebase are belong to us.Run `zig build test` to run the tests.

Congratulations, you have a working Zig installation!

Next steps

Check out other resources present in theLearn section, make sure to find the Documentation for your version of Zig (note: nightly builds should usemaster docs) and consider givingzig.guide a read.

Zig is a young project and unfortunately we don’t have yet the capacity to produce extensive documentation and learning materials for everything, so you should considerjoining one of the existing Zig communities to get help when you get stuck, as well as checking out initiatives likeZig SHOWTIME.

Finally, if you enjoy Zig and want to help speed up the development,consider donating to the Zig Software Foundation.