Xo is experimental. The source is now public on GitHub, or try Xo in your browser.
Menu · Getting started

Docs

Getting started

On this page

To install Xo, download the archive for your platform from the latest GitHub release (0.55.1: macOS and Linux on arm64 and x86-64, Windows on x86-64), check it against SHA256SUMS, unpack it, and put its bin directory on your PATH; xo version confirms it. Go is needed only for the Go backend and use go. Xo is experimental, and the language may change before 1.0.

Install

Download the archive for your platform from the latest release on GitHub. The current one is 0.55.1:

PlatformArchive
macOS, Apple siliconxo-v0.55.1-darwin-arm64.tar.gz
macOS, Intelxo-v0.55.1-darwin-amd64.tar.gz
Linux, arm64xo-v0.55.1-linux-arm64.tar.gz
Linux, x86-64xo-v0.55.1-linux-amd64.tar.gz
Windows, x86-64xo-v0.55.1-windows-amd64.tar.gz
Windows, arm64xo-v0.55.1-windows-arm64.tar.gz

Each archive holds bin/xo (bin\xo.exe on Windows), the toolchain, and lib/xo/std, the standard library, under one directory, xo-v0.55.1-<os>-<arch>. Keep bin and lib together: xo finds its standard library at ../lib/xo. The steps below unpack it into ~/xo without the versioned directory, so the PATH line stays the same when you upgrade; any directory works.

  1. Download the archive and SHA256SUMS, and check the archive.
  2. Unpack it into ~/xo. To upgrade later, remove ~/xo first, so no file of the old standard library stays behind, then repeat steps 1 and 2.
  3. Add ~/xo/bin to your PATH for good: the command appends the line to your shell’s startup file (~/.zshrc for zsh, the macOS default; ~/.bashrc for bash). Run it once.
  4. Open a new terminal and run xo version.

macOS (on Intel, use darwin-amd64; with bash, write ~/.bashrc for ~/.zshrc):

curl -LO https://github.com/xo-lang/xo/releases/download/v0.55.1/xo-v0.55.1-darwin-arm64.tar.gz
curl -LO https://github.com/xo-lang/xo/releases/download/v0.55.1/SHA256SUMS
shasum -a 256 -c --ignore-missing SHA256SUMS
mkdir -p ~/xo
tar -xzf xo-v0.55.1-darwin-arm64.tar.gz -C ~/xo --strip-components=1
echo 'export PATH="$HOME/xo/bin:$PATH"' >> ~/.zshrc

Linux (on x86-64, use linux-amd64; with zsh, write ~/.zshrc for ~/.bashrc):

curl -LO https://github.com/xo-lang/xo/releases/download/v0.55.1/xo-v0.55.1-linux-arm64.tar.gz
curl -LO https://github.com/xo-lang/xo/releases/download/v0.55.1/SHA256SUMS
sha256sum -c --ignore-missing SHA256SUMS
mkdir -p ~/xo
tar -xzf xo-v0.55.1-linux-arm64.tar.gz -C ~/xo --strip-components=1
echo 'export PATH="$HOME/xo/bin:$PATH"' >> ~/.bashrc

Then, in a new terminal:

xo version

Windows, in PowerShell (tar ships with Windows 10 and later). Step 3 adds ~\xo\bin to your user Path, which every new terminal and program sees, VS Code included; a line in the PowerShell profile ($PROFILE) would reach PowerShell only:

curl.exe -LO https://github.com/xo-lang/xo/releases/download/v0.55.1/xo-v0.55.1-windows-amd64.tar.gz
curl.exe -LO https://github.com/xo-lang/xo/releases/download/v0.55.1/SHA256SUMS
(Get-FileHash xo-v0.55.1-windows-amd64.tar.gz -Algorithm SHA256).Hash
Select-String windows-amd64 SHA256SUMS
New-Item -ItemType Directory -Force "$HOME\xo" | Out-Null
tar -xzf xo-v0.55.1-windows-amd64.tar.gz -C "$HOME\xo" --strip-components=1
[Environment]::SetEnvironmentVariable("Path", "$HOME\xo\bin;" + [Environment]::GetEnvironmentVariable("Path", "User"), "User")

On Windows on ARM, use windows-arm64 in place of windows-amd64 in the four lines that name the archive (there is no --race there).

Then, in a new PowerShell window:

xo version

On Windows, compare the two hashes by eye: Get-FileHash prints upper case and SHA256SUMS lower case. xo version prints xo 0.55.1 and the platform; xo version -v also names the commit the release was built from. A terminal or editor that was already open keeps the PATH it started with: open a new one.

  • macOS: the binaries are signed with a Developer ID and notarized. Gatekeeper checks the notarization online the first time a binary runs. If macOS still refuses a binary from a browser download, clear the download’s quarantine flag: xattr -dr com.apple.quarantine ~/xo.
  • Windows: xo.exe and xo-gobind.exe are Authenticode signed (since 0.26.0). PowerShell’s Get-AuthenticodeSignature bin\xo.exe shows the signature and its timestamp.
  • Go is needed only for the Go backend (--backend=go) and use go; the native backends need no Go.

Editor support

The Xo extension for VS Code gives syntax highlighting, and runs xo lsp (the xo on your PATH, or the xo.path setting) for diagnostics and quick fixes as you type, hover, go to definition, references, rename, and formatting. Install it from the Visual Studio Marketplace or, for VSCodium, Cursor and other editors that use it, from Open VSX, or search for “Xo Language” in the editor’s Extensions view. Debugging from the editor (F5 on a .xo file) runs xo debug --dap, which arrives in the next release. VS Code reads PATH when it starts: after changing PATH, quit and restart VS Code (every window), or set xo.path to the binary (for example ~/xo/bin/xo). The Xo output channel names the xo the extension runs and its version; when there is no xo on PATH, it may pick up an older bin/xo from an Xo checkout in the workspace, so set xo.path if the diagnostics look wrong for your code. Its source is xo-lang/vscode. Any other editor with a Language Server Protocol client can run xo lsp directly.

Build from source

The source is at github.com/xo-lang/xo.

The release archives are the quick way in. To build xo yourself: it is written in Xo, so an existing xo builds the next one. If you already have an xo, from a checkout of the repository:

XO_SEED=/path/to/xo go run ./scripts/xobuild
export PATH="$PWD/bin:$PATH"

It builds bin/xo from the checkout and prints its path; bin/xo finds the standard library at ../std. Without XO_SEED it looks for an earlier build of the checkout, or xo on your PATH, and stops with an error if it finds none.

With no xo at all, build from source:

go run ./scripts/xobuild --from-source
export PATH="$PWD/bin:$PATH"

This needs Go 1.26 or later and git, once. It builds the go-compiler-final tag, the last version of Xo’s original compiler written in Go, then a short recorded chain of intermediate versions, then the checkout. It is slow: the last measurement, on 2026-10-13, was 25 to 37 minutes on a 16 vCPU machine. After that, any xo rebuilds the next without Go (scripts/bootstrap-xo.sh).

On an arm64 host (Apple silicon, arm64 Linux) xo is built with the arm64 backend. On an x86-64 host it is built with the LLVM backend, which needs clang.

Programs build to native code by default, and what that needs depends on the backend:

  • --backend=arm64, the default on arm64 hosts: nothing. Xo’s own assembler and linkers build the binary, with no C toolchain, unless the program calls C with use c.
  • --backend=amd64, the default on x86-64 hosts: nothing, for Linux, Intel Macs, and Windows.
  • --backend=llvm: clang.
  • --backend=go, needed for use go: Go 1.24 or newer on the PATH (or XO_GO set to its go command); an older Go is reported as XO1502, and no Go at all as XO1503.

Time zone data ships with Xo’s standard library, so no backend needs Go for it.

A first program

Make a directory and create the module:

$ mkdir hello && cd hello
$ xo init example.com/hello
wrote xo.mod
added xo.work to .gitignore

Then add main.xo:

fn greet(name: Str) -> Str {
  "hello, ${name}"
}

test "greet" {
  expect(greet("Ada")) == "hello, Ada"
}

fn main(os: Os) {
  os.stdio.println(greet("world"))
}

Then check, run, and test it:

$ xo check .
1 module(s), 0 error(s), 0 warning(s)
$ xo run .
hello, world
$ xo test .
ok: 1 passed, 0 failed, 0 skipped

main receives the operating system as a capability (os). Code that needs the network, files, or the clock gets them from main, so a function’s signature shows what it can touch.

Diagnostics for agents

xo check --json reports every problem as JSON with a stable XOnnnn code, notes, and machine applicable fixes. xo explain <code> describes any code. Every code is listed, with an example and a fix, in the diagnostics reference.

Next

  • Take the tour: twelve short steps, each with a program that checks, runs, and passes its tests.
  • Read the core specification for everything in full.
  • See the realistic example service in examples/notes-service in the repository: HTTP and JSON, std/sql, auth middleware, a background job, and graceful shutdown.
↑ index