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:
curl -fsSL https://forgejo.roberthurst.ca/robert/Vyi/raw/branch/master/scripts/install.sh | bashIt 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:
export PATH="$HOME/.local/bin:$PATH"Check that the shell finds vyi:
vyi helpIt prints the list of commands.
Run a first program
Save this as hello.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:
vyi run hello.vyivyi 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:
- downloads the
vyiandvyi-language-serverbuilds for your machine, and the standard packages asvyi-stdlib.tar.gz, fromhttps://forgejo.roberthurst.ca/api/packages/robert/generic/vyi/<version>/ - installs the two programs into
$PREFIX/bin - empties
$PREFIX/share/vyiand unpacks the standard packages into it - prints the
export PATHline when$PREFIX/binisn't on yourPATH
PREFIX is ~/.local unless you set it:
| Path | Contents |
|---|---|
$PREFIX/bin/vyi | the compiler |
$PREFIX/bin/vyi-language-server | the 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:
curl -fsSL https://forgejo.roberthurst.ca/robert/Vyi/raw/branch/master/scripts/install.sh | PREFIX=/opt/vyi bash| Variable | Default | Meaning |
|---|---|---|
PREFIX | $HOME/.local | the install root; the script writes bin/ and share/vyi/ under it, so it needs write access there |
VYI_VERSION | latest | the published version to install: latest, the newest build, or a release tag such as v0.1.0. Only latest is published today |
VYI_INSTALL_BASE | https://forgejo.roberthurst.ca/api/packages/$VYI_OWNER/generic/vyi | where to download from, for a mirror |
VYI_OWNER | robert | the package owner in the default VYI_INSTALL_BASE |
NO_COLOR | unset | set to print without color |
VYI_FORCE_COLOR | unset | set (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:
./scripts/install.sh
PREFIX=/opt/vyi ./scripts/install.shIt 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:
git clone https://forgejo.roberthurst.ca/robert/Vyi.git
cd Vyi/bootstrap-compiler
go build -o vyi ./cmd/vyi
./vyi run path/to/hello.vyiA 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:
export VYI_STDLIB_PATH="$HOME/src/Vyi/packages"The language server builds the same way:
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:
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:
- the folder named by the
--packages <dir>flag $VYI_STDLIB_PATH$VYI_PACKAGES$XDG_DATA_HOME/vyi, which is~/.local/share/vyiwhenXDG_DATA_HOMEisn't setvyi/under each folder in$XDG_DATA_DIRS(/usr/local/shareand/usr/sharewhen it isn't set), then/usr/share/vyi../share/vyiand../packagesnext to thevyibinary, thenpackagesand../packagesin 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:
curl -fsSL https://forgejo.roberthurst.ca/robert/Vyi/raw/branch/master/scripts/install.sh | bash -s -- --uninstallPass the same PREFIX you installed with. From a checkout, run
./scripts/install.sh --uninstall.
Next steps
- Guide 01, Introduction: a tour of the language.
- Guide 17, Tooling: the commands, targets, and editor setup.
- The
vyiCLI: every command, flag, and exit status. - Targets:
wasm,x86-64-linux,arm64-linux, and the build modes.