-
Notifications
You must be signed in to change notification settings - Fork 3
Installation
The recommended way of installing the Zig compiler is with Zig Version Manager. ZVM helps you easily keep up to date with the language's rapid development. Installation of the version manage is a simple one-step process. Simply follow the instructions at the project's GitHub page.
After you have installed ZVM, run the following command in a terminal window to install the stable version of Zig:
zvm install --zls 0.13.0
Zigar 0.13.1 is designed to work with version 0.13.0 of the Zig compiler. If you want to use the latest feature set offered by the language, install the development version with the following command:
zvm install --zls master
You may also choose to download Zig manually.
When you're finished, run the following to verify that the compiler is available:
zig version
0.13.0
Zigar provides a pair of plugins to web developers interested in Zig: zigar-loader and rollup-plugin-zigar. The former is designed to work with webpack. The latter is designed to work with rollup and Vite.
In the project directory, run the appropriate command to install the right plugin:
npm install --save-dev zigar-loader
or
npm install --save-dev rollup-plugin-zigar
Zigar also provides a Node.js addon capable of loading native-code Zig modules: node-zigar. It's compatiable with Electron (with limitations) and NW.js.
To install, run the following command in the project directory:
npm install node-zigar
Bun.js is not compatible with node-zigar. You need to use a separate module instead: bun-zigar.
To install, run the following commands in the project directory:
bun install bun-zigar
bunx bun-zigar preload
The second command inserts bun-zigar
into the list of preloads in bunfig.toml
.