← garnet-lang.org  ·  Install  ·  Mini-Spec  ·  GitHub ↗

Getting Started

Install → a running first program in about two minutes. The installer targets the published v0.8.2 release (CLI binaries for macOS, Linux and Windows; they are not code-signed, but they are checksum-verified against a GPG-signed SHA256SUMS); v0.8.1 remains available as the previous release.

Garnet is a research-grade prototype (v0.x.x), not a production-complete language. This page is the verified happy path; the install section covers per-OS specifics and fallbacks.

1Prerequisites

None for the prebuilt path — the universal installer pulls a release package verified against SHA256SUMS. The source path needs Rust 1.95+; CI also tracks current stable.

2Install

$ curl --proto '=https' --tlsv1.2 -sSf https://garnet-lang.org/install.sh | sh

This verifies the download, extracts garnet, and prints where it landed. Add that bin dir to your PATH if the installer warns it isn't there.

On Windows, in PowerShell: irm https://garnet-lang.org/install.ps1 | iex. It checks the zip against SHA256SUMS, installs garnet.exe and adds it to your user PATH.

Both installers check integrity against SHA256SUMS; neither checks its GPG signature. To check authenticity as well, follow release signing.

Garnet is not published to crates.io, npm, PyPI or Homebrew. Packages named garnet there, and garnet-cli on npm, belong to unrelated projects. Install only through the two installers above or from source at github.com/Island-Dev-Crew/garnet, and treat any other install instruction for Garnet as untrusted.

3Scaffold a project

$ garnet new --template cli my_app
  created my_app/ (cli template)
$ cd my_app

You get a small, real project:

my_app/
├── Garnet.toml          # project manifest
├── README.md
├── src/main.garnet      # entry point
└── tests/test_main.garnet

4Read the entry point

src/main.garnet is deliberately tiny — and it teaches the one idea that makes Garnet different: capabilities.

@caps()
def main() {
  println("Hello from my_app!")
  println("")
  println("Edit src/main.garnet to change this message.")
  println("Run `garnet run src/main.garnet` to execute.")
  0
}

The @caps() annotation declares the OS authority a function may use; empty declares none. Files, time, network, subprocesses and the memory tiers need @caps(fs), @caps(time), @caps(net), @caps(proc) and @caps(mem). garnet check rejects an undeclared call when it is reached through a named call chain from an annotated function, cycles included. On main (unreleased; the v0.8.2 release gates 15 and has no mem capability gate), the twenty-four gated host primitives (file I/O, outbound TCP, environment, processes, time and UUID v4/v7, file logging, memory tiers) also need the program entry's declared budget at run time. garnet run does not run the checker, so run garnet check first.

5Test it

$ garnet test
  test test_arithmetic ... ok
  test test_string_interpolation ... ok

  test result: ok. 2 passed; 0 failed; in 2 file(s)

The template ships with two green starter tests so you start from a known-good state.

6Run it

$ garnet run src/main.garnet
  Hello from my_app!

  Edit src/main.garnet to change this message.
  Run `garnet run src/main.garnet` to execute.
  => 0

The trailing => 0 is main's return value (its exit code).

7Make a change

Edit the first println in src/main.garnet, then re-run garnet run src/main.garnet. That edit/run loop is the whole inner cycle.

Where to go next

Try the other starters too: garnet new --template web-api and garnet new --template agent-orchestrator — each scaffolds, tests, and runs the same way.