01 — Installation and Hello, vibe

Previous: Introduction

日本語版: 01_getting_started.vibe.md

Install

curl -fsSL https://raw.githubusercontent.com/mizchi/vibe-lang/main/install/install.sh | bash
. "$HOME/.vibe/env"
vibe version

Without a version, the installer builds vibe from source, so it needs git, cargo and Node.js on your machine and takes several minutes. With a published release, bash -s -- --version X.Y.Z (or latest) downloads prebuilt files instead and needs only bash, curl (or wget), tar and sha256sum (or shasum); the install guide has both.

From a checkout of this repository, bash install/install.sh does the same thing. You get the vibe command, a viberun host, and the standard library. The compiler itself is a wasm module.

Hello

Put this in hello.vibex:

fn main allows Console {
  println("hello, vibe")
}
hello, vibe
vibe run hello.vibex

println is built in, so there is nothing to import.

The .vibex extension marks an executable root: a file with exactly one fn main, which other files cannot import — and which therefore exports nothing (ADR-0075). Reusable source modules end in .vibe. One more file appears below: index.vpkg, a project's manifest, which is also a package's public contract — Modules and packages — declarations the compiler checks the implementation against.

The interesting part is allows Console. It is the program's permission to write to the terminal, and it is required: delete it and the program does not compile. The message names Console and tells you to write allows Console. That is the language's one big idea, showing up in the smallest program it has — a program states what it is allowed to do, and the compiler holds it to that.

main grants that permission, because nothing calls main; a function that main calls requires it, with with Console on its own signature. You will meet the same shape again for failure (with Exception) and for reading files (allows Fs::read_file). Capabilities is where it is finished.

Ask the compiler questions

vibe's CLI is built to be queried, not just run. The convention throughout is empty output means clean.

vibe check hello.vibex     # typecheck; prints nothing if it compiles
vibe run   hello.vibex     # compile and execute
vibe test  hello_test.vibe # run its test { } blocks

vibe check is the one to reach for while writing. It answers "does this compile" on its own, one diagnostic per line, and exits non-zero if there is anything to say.

There are more of these — vibe symbols, vibe type-at, vibe deps — and they exist so an editor, or you, or a script can ask the compiler what it knows. The CLI as an IDE covers them.

A project, when you want one

vibe new myapp
cd myapp
vibe run main.vibex

vibe new writes three files: main.vibex, the entry point; index.vpkg, the project's manifest, which also marks the project root so every vibe command finds it from any subdirectory; and .gitignore, which ignores .vibe/ — the directory where builds and pinned dependencies land. Modules and packages explains the manifest. You do not need any of it for a single file, which is why this chapter did not start there.

Next: A small program.