Get started

Install Canary, create a project, and run your first BAML function.

Run a BAML function from the terminal. This first example needs no model provider or API key.

Install the toolchain

Choose one installation method.

macOS or Linux

If you already use Homebrew:

brew install baml

Without Homebrew, run the installer in Bash or Zsh:

curl -fsSL https://pkg.boundaryml.com/install.sh | sh -s -- --yes
. "$HOME/.baml/env"

The installer adds BAML to your Bash or Zsh startup file. The second command makes baml available in the current terminal.

Windows

Run these commands in PowerShell:

$bamlInstaller = Invoke-RestMethod https://pkg.boundaryml.com/install.ps1
& ([scriptblock]::Create($bamlInstaller)) -Yes
$env:Path = "$env:USERPROFILE\.baml\bin;$env:Path"

The installer adds BAML to your user PATH. The last command makes it available in the current PowerShell session.

Arch Linux

If you use yay, install the AUR package:

yay -S baml-bin

Select Canary

These guides use Canary. Select it and download the latest toolchain:

baml toolchain use canary
baml toolchain update
baml --version

Create a project

baml new my-project
cd my-project

This creates baml.toml and baml_src/main.baml. Replace the contents of main.baml with:

BAMLreturn-number.baml
function return_number(value: int) -> int {
  value
}
function return_number(value: int) -> int {
  value
}

Check and run

baml check
baml run return_number -- --value 42

The function returns 42. Put function arguments after --; use baml run return_number -- --help to see the accepted arguments.

Add editor support

Editor support is optional. With VS Code installed, run:

baml ide install --code

For Cursor:

baml ide install --cursor

For another VS Code-compatible editor, save the extension locally:

baml ide install --output-dir .

In your editor's Extensions view, choose Install from VSIX and select the downloaded .vsix file.

Set up a coding agent

If you use a coding agent, run this from the project root:

baml agent install

This installs the active toolchain's BAML skill for supported agents. Use baml describe to inspect available functions and types while you work.

Update BAML

To get the latest Canary toolchain:

baml toolchain update

To update the baml launcher itself, use brew upgrade baml for a Homebrew installation, yay -S baml-bin for an AUR installation, or baml self-update for a script installation.

Next steps