Topaz 5.21.3 is the current release. Topaz 6.0 is not released.
Install Topaz 5.21.3 with the command for your system, then check that topaz starts. The sections from npm onward cover other installation methods and release files.
Install with one command
On macOS and Linux, run this command in a terminal.
curl -fsSL https://topaz.ooo/install.sh | sh
On Windows, run this command in PowerShell.
irm https://topaz.ooo/install.ps1 | iex
Each script picks the latest published release for your system and downloads the compressed program. It checks the download and the decompressed program against the SHA-256 checksums published with that release. The script puts topaz in ~/.topaz/bin on macOS and Linux, and in %LOCALAPPDATA%\Topaz\bin on Windows.
Check the installation
Open a new terminal and check that it finds Topaz.
topaz version
The installed release is Topaz 5.21.3. Read that version when checking an installation or reporting a problem.
The latest published release is v5.21.3.
If the command is not found, open a new terminal and check that the installation folder is on PATH. The Windows script adds its folder to your user PATH. On macOS and Linux, the script prints the export PATH=... line to add when the folder is not on PATH yet.
First run
Save this code as first-program.tpz in your working folder.
import std.io
let topic = "Topaz basics"
let minutes: int = 25
io.writeLine("{topic}: {minutes} minutes")
In that folder, check the file and run it.
topaz check first-program.tpz
topaz run first-program.tpz
check reports the type and name checks without running the file.
first-program.tpz: types-ok (2 modules)
first-program.tpz: resolve-ok (2 modules)
run checks the file before printing this result.
Topaz basics: 25 minutes
The first let names a string, so the checker infers its type. The second let declares minutes as an int, an integer. io.writeLine inserts the values inside {...} into the output.
Start without installing
The Playground edits, checks and runs Topaz in your browser without the CLI. It loads the compiler and interpreter WASM in a Worker.
Install with npm
With Node.js 18 or newer, npm can install Topaz. The topaz-lang package runs an installer script that downloads the program for your system and checks it against the published SHA-256 checksums.
Install for every folder
npm install -g --allow-scripts=topaz-lang topaz-lang
topaz version
--allow-scripts=topaz-lang lets npm run the installer of topaz-lang and of no other package. To install one of the published releases below instead of the latest, put its number after topaz-lang@.
Install in one folder
To keep Topaz inside one project folder, install it there and run it through npx.
npm install topaz-lang
npx topaz version
The same command is at node_modules/.bin/topaz.
Answer the install script warning
npm 11 prints an npm warn allow-scripts warning that names topaz-lang and its postinstall script. The installer has still run. To record your approval in the folder's package.json and stop the warning, run this command in that folder.
npm approve-scripts topaz-lang
npm 12 runs an install script only with your permission. If npx topaz version reports binary not found, the installer did not run. Approve it as above, then run the installer again.
npm rebuild topaz-lang
Download a file directly
Each published release lists its executables with their size and SHA-256 checksum. The .gz, .xz, and .br files hold the same program, compressed. The versions below are the published releases.
Published
| Platform | Executable |
|---|---|
Linux x86_64 | topaz-linux-x86_64.gz41.9 MB· 41,926,258 bytes SHA-256 9c6ee0bfba8858f1595d7af2c09138a5a94fe523059b94d3ca310b21642fd02bExecutabletopaz-linux-x86_64109.4 MB· 109,423,280 bytes SHA-256 b6c3f574b78c558b526196fa04f5d835c9fe1df59d07397dbf4e5d279a3e1665 |
Linux arm64 | topaz-linux-aarch64.gz41.8 MB· 41,836,994 bytes SHA-256 3aceff634f4b0ae9347c53b0b08821978ce0e4b359611b96d348a4fb20ef3e98Executabletopaz-linux-aarch6486.9 MB· 86,862,592 bytes SHA-256 5873a12ff644ce2e9dac19755e2456687b7bb185ba7a75d0b6e78bae35907d6b |
macOS Intel | topaz-macos-x86_64.gz41.3 MB· 41,303,200 bytes SHA-256 9e4ef2a99b575c168695433d48c76132925fbd7114d609f7f69fdbec80aa566bExecutabletopaz-macos-x86_64103.6 MB· 103,635,744 bytes SHA-256 b90251a108db0b28c0d26a9051cb7123666c280d3f94cf2704fb50d675e4a322 |
macOS Apple silicon | topaz-macos-aarch64.gz39.9 MB· 39,938,546 bytes SHA-256 809b105da9ab06aac2d93c2d603c8a02acc4620651f547da769cd2efbb1ba059Executabletopaz-macos-aarch6483.3 MB· 83,339,440 bytes SHA-256 6c690a3e4322fd7a42226e98cd79279b4f52fd377d1c5d16ba46ffd1543e7c7b |
Windows x86_64 | topaz-windows-x86_64.exe.gz40.4 MB· 40,378,137 bytes SHA-256 e03789dfb189c3531e771dd2aef00897266ceb716e936f5650a02d80713c1f1dExecutabletopaz-windows-x86_64.exe102.9 MB· 102,873,600 bytes SHA-256 81111a53ac5da2ebc403438922b42fc1dfdd68782c6324fed4219297b7a7e445 |
Check a file before you run it. On Linux, print its SHA-256 checksum with sha256sum.
sha256sum topaz-linux-x86_64
On macOS, use shasum -a 256 topaz-macos-aarch64 with your file name. In PowerShell on Windows, use Get-FileHash.
Get-FileHash .\topaz-windows-x86_64.exe -Algorithm SHA256
The value must match the SHA-256 shown for that file and the value in its .sha256 file. PowerShell prints it in capital letters. A compressed file needs one more step. Decompress a .gz file with gzip -d and an .xz file with xz -d. Decompress a .br file with brotli -d from the Brotli tools, or download the uncompressed executable in the table if you do not have them. Then check the program you get against the executable's SHA-256.
Put the program in a folder on PATH under the name topaz, or topaz.exe on Windows. On macOS and Linux, also make it executable.
mkdir -p ~/.topaz/bin
mv topaz-linux-x86_64 ~/.topaz/bin/topaz
chmod +x ~/.topaz/bin/topaz
Then check it with topaz version as above.
Add tools for native and Web builds
topaz check and topaz run need nothing else. Native builds also need Rust with Cargo for the target platform. Web builds also need the Rust target wasm32-unknown-unknown.
A native build produces target/release/program on Unix and target/release/program.exe on Windows. The executable runs without Rust or Topaz. Keep topaz-artifact.json, LICENSE, NOTICE and GENERATED-OUTPUT-NOTICE.txt with the product folder when copying it.
Call Topaz from JavaScript
For local builds, install Rust with Cargo and wasm32-unknown-unknown. The JavaScript example runs with Node.js. The finished browser package runs without Topaz or Rust.
Build a Web package
In a new folder, save this complete program as main.tpz.
export function remaining(total: int, used: int) -> int {
total - used
}
Run the build from that folder.
topaz build --target web main.tpz --release --out-dir web-product
When the build finishes, it prints the paths of topaz-web.wasm and its loader topaz-web.js. The web-product folder contains topaz-web.js, topaz-web.d.ts and topaz-web.wasm. Your JavaScript application supplies the UI and calls exported functions through the module.
Call the function from JavaScript
Save this package.json beside main.tpz so Node.js reads the generated .js file as an ES module.
{ "type": "module" }
Save the following file as call.mjs in the same folder.
import { readFile } from 'node:fs/promises';
import { instantiateTopaz } from './web-product/topaz-web.js';
const wasm = await readFile(
new URL('./web-product/topaz-web.wasm', import.meta.url)
);
const app = await instantiateTopaz(wasm);
const result = app.exports.remaining(
{ $: 'int', value: '45' },
{ $: 'int', value: '20' }
);
console.log(JSON.stringify(result));
Run the JavaScript file from the folder containing main.tpz.
node call.mjs
The call produces this result.
{"status":"ok","value":{"$":"int","value":"25"}}
status: "ok" means the call succeeded. The result is a Topaz integer whose decimal text is "25". Each input also includes the int tag and decimal text. This preserves the integer value when passing through JavaScript.
The generated topaz-web.d.ts describes this argument and result format, called the ABI. Check status before reading value. A fault result includes an error code, message, and source span. An error result includes a message. Correct the named export, arguments, or reported Topaz source before calling again.
In a browser, serve the complete product over HTTP. Import instantiateTopaz in a module script and pass it the URL of topaz-web.wasm. The exported function takes the same tagged arguments. Browsers do not support loading this package directly through file://.
Use a Worker for calls off the main thread
Build the same main.tpz for a Worker when its calls should run outside the browser main thread.
topaz build main.tpz --target web-worker --release --out-dir worker-product
The result includes the Web files plus topaz-web-worker.js and topaz-web-worker-client.js. The client sends requests and receives responses using the same argument and result format. Its calls are asynchronous. Your JavaScript application still supplies the UI and permissions. A Worker does not grant extra capabilities.
Recover from loading and build errors
| Problem | Action |
|---|---|
| The Rust WASM target is missing | Install wasm32-unknown-unknown in the Rust toolchain used by the build |
| The browser reports a host/runtime identity mismatch | Deploy the entire folder from one build. Keep its JavaScript and WASM files together |
| The output folder contains changed managed files | Preserve it for inspection and choose a new empty --out-dir |
Set up your editor
In VS Code or an Open VSX-compatible editor, install the official Topaz extension from the Visual Studio Marketplace or Open VSX Registry. It recognizes .tpz files, adds the Topaz icon, and highlights syntax.
The extension starts the installed topaz lsp to show error messages in the editor. The compiler is installed separately. Make sure the editor can find it on PATH, or set topaz.executablePath to its location. You can also use topaz check in the terminal.
Check the release signature
checksums.txt lists the SHA-256 of every file in a release. checksums.txt.sig is its Ed25519 signature. Download both with the release public key topaz-release.pub from the links under the file table, then check the signature with OpenSSL 3 in that folder.
openssl pkeyutl -verify -pubin -inkey topaz-release.pub -rawin -in checksums.txt -sigfile checksums.txt.sig
OpenSSL prints Signature Verified Successfully. The release manifest lists every file the release published.
The public repository studiohaze/topaz publishes release verification records. Checking the release attestation lists the files covered by each release and shows how to verify them with the GitHub CLI.
Source and licenses
The seed holds the compiler written in Topaz, the Rust it generates and the runtime that builds that Rust, under Apache-2.0. A compiler built from it with Cargo compiles the Topaz source back into the same Rust.
Compiler seed
SHA-256 e2c7546f3ecb77668ab7008d71ce68de79f2f50d8525d8cbaa65ba369619bdfbSHA-256 1dc7bd519ded9a4fa57eb05059739b279e3e8ecbb1d3142c7b95f0a7783e2088SHA-256 1169c56ad2593a28746702ad75e1fe243379f1b25dc5e3006312edb2220f71aeSHA-256 bc8ef4168aeeca5686e6220fc53ebea3a2bd2b173bf6412197335c7bd9c3edfeSHA-256 5c559f9741d28096983d97d226c62589e6f50d2b7e7bd132ae555a5d0ece4fbfRead Public Source and Licenses for component terms and how to build the compiler from its seed.
To build the CLI yourself with the public compiler, or to check that two executables built from the same source match, see the Topaz Core Kit build guide. Prebuilt Core Kit archives for macOS, Windows and Linux are on its GitHub release.
| Platform | Core Kit download |
|---|---|
| macOS Apple silicon | aarch64-apple-darwin |
| macOS Intel | x86_64-apple-darwin |
| Windows x86_64 | x86_64-pc-windows-msvc |
| Linux x86_64 | x86_64-unknown-linux-gnu |
Release history
Choose a published release to see its files and source.
| Release version | Published | File |
|---|---|---|