Install moxzialpha
Install the moxzi compiler and server on macOS or Linux and check that they work.
This page installs moxzi (the compiler) and moxzid (the server). Builds are available for macOS and Linux on both arm64 and x86-64. Windows isn't supported yet.
Install with the script#
curl -fsSL https://moxzi.ai/install.sh | sh
The script downloads the release for your platform, checks it against the release's SHA256SUMS, and installs into ~/.local:
| Path | Contents |
|---|---|
~/.local/bin/moxzi | The compiler CLI |
~/.local/bin/moxzid | The actor server |
~/.local/lib/moxzi/compiler.wasm | The Motoko compiler. moxzi runs it |
~/.local/lib/moxzi/linker.wasm | Links compiled code with the Motoko runtime |
If ~/.local/bin isn't on your PATH, the script prints the line to add to your shell profile.
The script stops if a checksum doesn't match. If your system has neither shasum nor sha256sum, it warns and installs without checking; install one of them first if that matters to you.
Options#
Set these before sh in the pipeline, for example curl … | MOXZI_PREFIX=/opt/moxzi sh.
| Variable | Default | Effect |
|---|---|---|
MOXZI_PREFIX | ~/.local | Install under this directory instead |
MOXZI_VERSION | latest | Install a specific version, such as 0.1.0-alpha.7 |
MOXZI_BASE_URL | Install from this directory instead of moxzi.ai. It must hold the tarball and SHA256SUMS. Accepts file:// URLs |
Check the install#
moxzi --version
moxzi 0.1.0-alpha.10 (2efdae9a55)
Then build something. Save this as hello.mo:
actor {
public query func greet(name : Text) : async Text {
"Hello, " # name # "!"
};
};
moxzi build hello.mo
hello.mo -> hello.wasm + hello.did (246457 bytes, 1 file(s), 50 steps, 0.58s)
compiled by ~/.local/lib/moxzi/compiler.wasm (sha256 9294817c6e9069cbd0e712d0e9dde0ec1b6893d0e7b42d798fa3dd4c8cd772cb), moxzi 0.1.0-alpha.10
The first line names the files written: hello.wasm, the compiled actor, and hello.did, its Candid interface. The second line identifies the compiler that built it by hash.
The first build after installing takes a second or two longer than later ones while moxzi prepares the compiler for your CPU. The result is cached.
Install from a tarball#
If you'd rather not pipe a script into sh, download the tarball for your platform and SHA256SUMS from https://moxzi.ai/releases/, then:
shasum -a 256 -c SHA256SUMS --ignore-missing
tar -xzf moxzi-0.1.0-alpha.7-aarch64-apple-darwin.tar.gz
cd moxzi-0.1.0-alpha.7-aarch64-apple-darwin
./moxzi --version
The unpacked directory works as is. To put it on your PATH, copy moxzi, moxzid, compiler.wasm and linker.wasm into one directory, or use the bin/ and lib/moxzi/ layout shown above.
How moxzi finds the compiler#
moxzi and moxzid look for compiler.wasm and linker.wasm in this order:
- The
--compilerand--linkeroptions. - The
MOXZI_COMPILERandMOXZI_LINKERenvironment variables. - The directory containing the
moxzibinary. ../lib/moxzi/relative to the binary.
If none of these has the files, the error lists every path it tried. moxzi info shows which files were found and their hashes.
Uninstall#
moxzi cache clear
rm ~/.local/bin/moxzi ~/.local/bin/moxzid
rm -r ~/.local/lib/moxzi
moxzi cache clear removes the compiled-compiler cache (under ~/Library/Caches/moxzi on macOS, ~/.cache/moxzi on Linux).
Next steps#
- Your first actor: run an actor, call it and upgrade it.
- Building with the CLI: flags, output and build caching.