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.
Quick install
Section titled “Quick install”curl -fsSL https://raw.githubusercontent.com/brinelang/brine/main/install.sh | shThe 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.
In PowerShell (5.1 or later):
irm https://raw.githubusercontent.com/brinelang/brine/main/install.ps1 | iexThe script downloads brine-windows-x64.zip, checks it against the
release’s SHA256SUMS, puts brine.exe in %USERPROFILE%\.brine\bin and
adds that folder to your user PATH. New terminals see it; the current
PowerShell session can use it right away. On Windows on ARM it installs the
x64 build, which runs under emulation.
Then check the install:
brine --versionbrine 0.4.0Run the installer again to upgrade to the latest release.
Installer settings
Section titled “Installer settings”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) |
curl -fsSL https://raw.githubusercontent.com/brinelang/brine/main/install.sh | BRINE_VERSION=0.4.0 sh$env:BRINE_VERSION = '0.4.0'irm https://raw.githubusercontent.com/brinelang/brine/main/install.ps1 | iexRequirements
Section titled “Requirements”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.
xcode-select --install # macOSsudo apt install gcc # Debian, Ubuntusudo dnf install gcc # Fedorawinget install -e --id BrechtSanders.WinLibs.POSIX.UCRT# orscoop install mingw-winlibsTo use a specific compiler, set BRINE_CC (or CC) to its name or path.
Check your setup
Section titled “Check your setup”brine doctor checks each part of the toolchain and builds and runs a small
parallel program:
brine doctor ✓ 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 gdbA ✗ 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.
WebAssembly
Section titled “WebAssembly”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.
Supported platforms
Section titled “Supported platforms”| 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.
Prebuilt archives
Section titled “Prebuilt archives”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.
Uninstall
Section titled “Uninstall”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.
rm -rf ~/.brineDelete %USERPROFILE%\.brine and remove its bin folder from your user
PATH (Settings → System → About → Advanced system settings → Environment
Variables).
Remove-Item -Recurse -Force "$HOME\.brine"Build from source
Section titled “Build from source”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.
git clone https://github.com/brinelang/brine && cd brinecc -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 itselfWith MinGW gcc or clang:
git clone https://github.com/brinelang/brine && cd brinegcc -std=c11 -O2 -fno-strict-aliasing -w -Iruntime bootstrap/brinec.c runtime/brine_rt.c -o brine.exe -lws2_32 -lshell32./brine build compiler/main.br -o brine2The 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.
- Your first project:
brine new,run,checkandtest. - A tour of Brine: the whole language, one example at a time.