Docs · Toolchain

Installing Vyi

Vyi runs on Linux, on x86-64 (amd64) and arm64 machines. This page installs the toolchain, runs a first program, and then covers the install script's options, building from source, where vyi finds the standard packages, and uninstalling.

Install

Run the install script:

sh
curl -fsSL https://forgejo.roberthurst.ca/robert/Vyi/raw/branch/master/scripts/install.sh | bash

It installs vyi and vyi-language-server into ~/.local/bin. If that folder isn't on your PATH, the script says so. Add it for this shell, and to your shell's startup file to keep it:

sh
export PATH="$HOME/.local/bin:$PATH"

Check that the shell finds vyi:

sh
vyi help

It prints the list of commands.

Run a first program

Save this as hello.vyi:

Vyi
import { println } from "@fmt"

fn main() !u8 {
    println("hello, world")   // prints hello, world
    return Ok(0)
}

Run it from the folder that holds it:

sh
vyi run hello.vyi

vyi run compiles the program to WebAssembly and runs it with a runtime built into vyi, so it needs nothing else installed. The 0 in Ok(0) is the exit status. The guides start from here, and guide 17, Tooling shows the commands you use day to day.

Compiling to a native Linux program (--target x86-64-linux or --target arm64-linux) also needs a C compiler to link it. Targets lists what each target needs.

What the script does

The script needs curl, tar, uname, mktemp, and install on your PATH. It stops with an error on an operating system other than Linux or a machine other than x86-64 or arm64. Then it:

  1. downloads the vyi and vyi-language-server builds for your machine, and the standard packages as vyi-stdlib.tar.gz, from https://forgejo.roberthurst.ca/api/packages/robert/generic/vyi/<version>/
  2. installs the two programs into $PREFIX/bin
  3. empties $PREFIX/share/vyi and unpacks the standard packages into it
  4. prints the export PATH line when $PREFIX/bin isn't on your PATH

PREFIX is ~/.local unless you set it:

PathContents
$PREFIX/bin/vyithe compiler
$PREFIX/bin/vyi-language-serverthe language server, for editors
$PREFIX/share/vyi/the standard packages: @core, @fmt, @io, @mem, and the rest

Both programs are single files with no other dependencies. vyi finds the standard packages in ../share/vyi next to itself, so the layout works under any PREFIX. Running the script again replaces all three with the latest build, which is how you update.

Options

The script reads these environment variables. Set them on the bash side of the pipe, so that the script sees them:

sh
curl -fsSL https://forgejo.roberthurst.ca/robert/Vyi/raw/branch/master/scripts/install.sh | PREFIX=/opt/vyi bash
VariableDefaultMeaning
PREFIX$HOME/.localthe install root; the script writes bin/ and share/vyi/ under it, so it needs write access there
VYI_VERSIONlatestthe published version to install: latest, the newest build, or a release tag such as v0.1.0. Only latest is published today
VYI_INSTALL_BASEhttps://forgejo.roberthurst.ca/api/packages/$VYI_OWNER/generic/vyiwhere to download from, for a mirror
VYI_OWNERrobertthe package owner in the default VYI_INSTALL_BASE
NO_COLORunsetset to print without color
VYI_FORCE_COLORunsetset (to anything but 0) to print in color even when the output isn't a terminal

It takes two flags: --uninstall (below) and -h or --help, which prints its usage. Any other argument is an error.

From a checkout of the repository, run the script directly:

sh
./scripts/install.sh
PREFIX=/opt/vyi ./scripts/install.sh

It downloads the same published builds; it doesn't build the checkout.

Build from source

Building from source needs Git and Go 1.26.3 or later. Clone the repository and build the compiler:

sh
git clone https://forgejo.roberthurst.ca/robert/Vyi.git
cd Vyi/bootstrap-compiler
go build -o vyi ./cmd/vyi
./vyi run path/to/hello.vyi

A vyi built in bootstrap-compiler/ finds the standard packages in the repository's packages/ folder next to it. If you move the binary, point it at that folder with VYI_STDLIB_PATH:

sh
export VYI_STDLIB_PATH="$HOME/src/Vyi/packages"

The language server builds the same way:

sh
cd Vyi/bootstrap-language-server
go build -o vyi-language-server .

To install a source build in the layout the script uses, copy the two programs and the packages:

sh
mkdir -p ~/.local/bin ~/.local/share/vyi
install -m 0755 bootstrap-compiler/vyi ~/.local/bin/vyi
install -m 0755 bootstrap-language-server/vyi-language-server ~/.local/bin/vyi-language-server
cp -a packages/. ~/.local/share/vyi/

Run these from the repository's root folder.

Where vyi finds the standard packages

Every command needs the standard packages. vyi uses the first of these folders that holds @core:

  1. the folder named by the --packages <dir> flag
  2. $VYI_STDLIB_PATH
  3. $VYI_PACKAGES
  4. $XDG_DATA_HOME/vyi, which is ~/.local/share/vyi when XDG_DATA_HOME isn't set
  5. vyi/ under each folder in $XDG_DATA_DIRS (/usr/local/share and /usr/share when it isn't set), then /usr/share/vyi
  6. ../share/vyi and ../packages next to the vyi binary, then packages and ../packages in the current folder

When none of them holds @core, every command stops with no @core package found; set VYI_STDLIB_PATH and exit status 1.

The language server looks in the same places, and takes the same --packages flag.

Uninstall

--uninstall removes $PREFIX/bin/vyi, $PREFIX/bin/vyi-language-server, and $PREFIX/share/vyi:

sh
curl -fsSL https://forgejo.roberthurst.ca/robert/Vyi/raw/branch/master/scripts/install.sh | bash -s -- --uninstall

Pass the same PREFIX you installed with. From a checkout, run ./scripts/install.sh --uninstall.

Next steps