Skip to content

Start here

Installation

One command installs the brine tool into ~/.brine/bin and adds it to your PATH. Brine also needs a C compiler on your machine; run brine doctor afterwards to check that everything works.

Terminal window
curl -fsSL https://raw.githubusercontent.com/brinelang/brine/main/install.sh | sh

The script picks the build for your system (linux or macos, x64 or arm64), checks it against the release’s SHA256SUMS, and puts brine in ~/.brine/bin. It adds that folder to your PATH in your shell’s startup file (~/.zshrc, ~/.bashrc, ~/.bash_profile on macOS bash, ~/.config/fish/conf.d/brine.fish, or ~/.profile). Open a new terminal, or run the export line it prints.

Then check the install:

Terminal window
brine --version
brine 0.4.0

Run the installer again to upgrade to the latest release.

Set these environment variables before running the installer:

Variable Effect
BRINE_VERSION=0.4.0 install a given version (default: the latest release)
BRINE_INSTALL=~/.brine where to install; the binary goes in $BRINE_INSTALL/bin
BRINE_NO_MODIFY_PATH=1 don’t add Brine to your PATH (the installer prints the folder to add yourself)
BRINE_DOWNLOAD_URL=... where the release files are, for mirrors (default: GitHub releases)
Terminal window
curl -fsSL https://raw.githubusercontent.com/brinelang/brine/main/install.sh | BRINE_VERSION=0.4.0 sh

Brine needs a C compiler: gcc or clang, or MinGW on Windows. It uses it to build the runtime, to link your program, and for --release builds. The installer warns you if it can’t find one.

Terminal window
xcode-select --install # macOS
sudo apt install gcc # Debian, Ubuntu
sudo dnf install gcc # Fedora

To use a specific compiler, set BRINE_CC (or CC) to its name or path.

brine doctor checks each part of the toolchain and builds and runs a small parallel program:

Terminal window
brine doctor
Output on Windows
✓ brine 0.4.0 (windows x86_64)
✓ C compiler gcc — gcc (MinGW-W64 x86_64-ucrt-posix-seh, built by Brecht Sanders, r1) 16.2.0
✓ parallelism 32 hardware threads
✓ local sockets needed for `brine run --ranks`
✓ build + run compiled and ran a parallel program
✓ debugger gdb

A ✗ line says what’s missing. The debugger (gdb or lldb) is optional; you only need it for brine debug.

GPU offload needs nothing at build time. If an NVIDIA driver or an Apple silicon GPU is present when your program runs, Brine can use it; otherwise everything runs on the CPU. There is no CUDA toolkit or SDK to install. See GPU offload.

Building for WebAssembly (--target wasm or --target web) also needs wasi-sdk: unpack it and set WASI_SDK_PATH to its folder. brine run --target wasm runs the result with Node.js. Both are optional, and WebAssembly support isn’t in a release yet: build Brine from source to use it. See WebAssembly.

Platform Prebuilt Native dev builds GPU
Linux x86-64 ✅ ✅ NVIDIA (CUDA)
Linux ARM64 ✅ ✅ NVIDIA (CUDA)
Windows x86-64 ✅ ✅ NVIDIA (CUDA)
macOS Apple silicon ✅ via C Apple GPU (Metal)
macOS Intel ✅ via C –

“Native dev builds” means the compiler writes machine code itself, so dev builds are fast. Everywhere else, and for every --release build, it goes through the C compiler. See Platforms and Builds and backends.

Every release on the releases page has an archive per platform and a SHA256SUMS file:

File Contains
brine-linux-x64.tar.gz brine-linux-x64/brine
brine-linux-arm64.tar.gz brine-linux-arm64/brine
brine-macos-arm64.tar.gz brine-macos-arm64/brine
brine-macos-x64.tar.gz brine-macos-x64/brine
brine-windows-x64.zip brine-windows-x64\brine.exe

The archive holds a single executable. Put it anywhere on your PATH.

Delete ~/.brine (or your BRINE_INSTALL folder), then remove the lines the installer added to your shell’s startup file: a # brine comment followed by an export PATH=... (or fish_add_path) line.

Terminal window
rm -rf ~/.brine

The compiler is written in Brine, so the first build starts from the C that Brine generates for itself, the bootstrap seed bootstrap/brinec.c. All you need is a C11 compiler.

Terminal window
git clone https://github.com/brinelang/brine && cd brine
cc -std=c11 -O2 -fno-strict-aliasing -w -Iruntime bootstrap/brinec.c runtime/brine_rt.c -o brine -lm -lpthread -ldl
./brine build compiler/main.br -o brine2 # brine rebuilding itself

The first command gives you the full brine tool. The second has it rebuild the compiler from its Brine sources. A correct compiler reaches a fixed point: building again with brine2 gives the same C.