Getting Started
Install a prebuilt binary
Section titled “Install a prebuilt binary”Beta builds of karac (0.8.x) are published on the
releases page; pick the newest
v0.8.x, since a beta is a prerelease and is not marked “latest”. Each release
carries self-contained bundles (no LLVM or Rust required on your machine) for:
- Linux x86_64 (
x86_64-linux) - Linux ARM64 (
aarch64-linux) - macOS Apple silicon (
aarch64-macos)
The Linux builds need glibc 2.35 or newer (Ubuntu 22.04, Debian 12 and later). Windows, Intel macOS and older distros build from source.
Paste this into a terminal. It picks your platform, downloads the release,
checks its SHA-256, unpacks it and puts karac on your PATH:
V=0.8.1case "$(uname -s)-$(uname -m)" in Darwin-arm64) P=aarch64-macos ;; Linux-x86_64) P=x86_64-linux ;; Linux-aarch64) P=aarch64-linux ;; *) P=unsupported; echo "No prebuilt karac for $(uname -sm); build from source (below)." ;;esacT=karac-$V-$Pcurl -fLO "https://github.com/karalang/kara/releases/download/v$V/$T.tar.gz" &&curl -fLO "https://github.com/karalang/kara/releases/download/v$V/$T.tar.gz.sha256" &&{ sha256sum -c "$T.tar.gz.sha256" 2>/dev/null || shasum -a 256 -c "$T.tar.gz.sha256"; } &&tar xzf "$T.tar.gz" &&{ [ "$P" != aarch64-macos ] || xattr -dr com.apple.quarantine "$T"; } &&export PATH="$PWD/$T/bin:$PATH" &&karac --versionIt should print karac 0.8.1+g…. On macOS, the xattr line clears the
Gatekeeper quarantine flag that every downloaded binary gets.
The layout is relocatable — karac finds its runtime libraries relative to
its own location, so the unpacked directory can live anywhere. The export PATH only lasts for this shell; to make it stick, add it to your shell
profile with the full path, for example
export PATH="$HOME/karac-0.8.1-aarch64-macos/bin:$PATH".
karac run (JIT) works out of the box. karac build (native binaries)
additionally needs a C linker — build-essential on Debian/Ubuntu, Xcode
Command Line Tools on macOS. The WebAssembly target (--target=wasm_wasi) also
needs a wasm linker: the rust-lld of any rustup toolchain,
or LLVM’s wasm-ld 20 or newer.
These are pre-1.0 beta builds: expect breakage, and report issues with the
exact karac --version string — its +g<sha> suffix pins the commit the
binary was built from.
Build from source
Section titled “Build from source”Alternatively, build karac yourself. You’ll need a
Rust toolchain and, for native compilation, LLVM 22.
git clone https://github.com/karalang/karacd karacargo build --release --features llvm# Runtime archives for `karac build` — lean first, then full (order matters:# both emit the same canonical filename).cargo rustc -p karac-runtime --release --no-default-features --features net --crate-type staticlibcp target/release/libkarac_runtime.a target/release/libkarac_runtime_min.acargo rustc -p karac-runtime --release --crate-type staticlibThe compiler is at target/release/karac; add it to your PATH. See the
repository README for the
full recipe, including the WebAssembly runtime archives.
Hello, world
Section titled “Hello, world”Create hello.kara:
fn main() { println("Hello, world!");}Build and run it:
karac run hello.karaOr compile a native binary:
karac build hello.kara./helloNext steps
Section titled “Next steps”Full language documentation is in progress. Until then:
- Browse the Kāra repository
- See real programs and benchmarks in kara-katas