Learn · 03
Installation & First Program
Install Ochre v0.1.0-alpha.4 with fail-closed SHA-256 verification, verify your installation, and run your first .och program.
You can install the single ochre binary in under ten seconds using the verified installer script, or compile it directly from source with Cargo.
Installing Ochre
Both official installers download SHA256SUMS.txt alongside the release archive and fail closed if checksum verification fails or the manifest is unavailable. You can also pin an exact release with OCHRE_VERSION.
Linux & macOS
# Install the latest release
curl -fsSL https://raw.githubusercontent.com/ochre-sh/ochre/main/install.sh | sh
# Or pin a specific version
curl -fsSL https://raw.githubusercontent.com/ochre-sh/ochre/main/install.sh | OCHRE_VERSION=v0.1.0-alpha.4 sh
Windows (PowerShell)
# Install the latest release
irm https://raw.githubusercontent.com/ochre-sh/ochre/main/install.ps1 | iex
# Or pin a specific version
$env:OCHRE_VERSION="v0.1.0-alpha.4"; irm https://raw.githubusercontent.com/ochre-sh/ochre/main/install.ps1 | iex
From Source (Requires Rust 1.80+)
cargo install --git https://github.com/ochre-sh/ochre ochre-cli
Verify Your Installation
ochre --version
ochre 0.1.0-alpha.4
Your First Program
Create a file named hello.och (or run it directly below):
fn main() {
let language = "Ochre"
let year = 2026
println("Hello from {language} ({year})!")
}
Expected Output
Hello from Ochre (2026)!
Run it from your terminal:
ochre hello.och
You can also use the explicit run subcommand, or pass arguments to your script:
ochre run hello.och -- arg1 arg2
Scaffolding a Project
For multi-file projects, use ochre init to create a starter layout with ochre.toml and src/main.och:
ochre init my-app
ochre my-app/src/main.och
Essential Everyday Commands
| Command | Purpose |
|---|---|
ochre app.och | Type-check and run on the bytecode VM |
ochre check app.och | Syntax and type-check without executing |
ochre fmt -w app.och | Format code in place (preserves comments & raw strings) |
ochre test | Discover and run all fn test_*() functions |
ochre repl | Start an interactive session |
Common Mistake: Missing fn main()
Top-level statements are allowed in quick scripts, but structured programs define fn main() as their entry point. If you call an undefined function such as print_line, the type checker catches it immediately:
fn main() {
print_line("Hello!")
}
Exercise
Write a program that stores your favorite language and a rating (1 to 10) in two let variables and prints a formatted sentence using string interpolation.
Show Solution
fn main() {
let lang = "Ochre"
let rating = 10
println("Trying {lang} — rating: {rating}/10")
}