Build from Source

July 7, 2026 · View on GitHub

This guide covers prerequisites, platform-specific requirements, and build steps for compiling Browser4 from source.

Prerequisites

ToolMinimum VersionRequired ForNotes
GitanyClone, root discovery
JDK17+ (21+ recommended)Build & runtimeEclipse Temurin recommended. JDK 21+ enables best jlink compression (zip-9).
Maven3.9+Java buildIncluded via mvnw wrapper — no separate install needed.
PowerShell 7 (pwsh)7.0+Runtime bundle assembly (jlink)Required on Linux and macOS. Built-in on Windows (powershell.exe). Install: curl -fsSL https://aka.ms/install-powershell.sh | bash
JDK tools (jdeps, jlink, jpackage)bundled with JDK 16+Runtime bundle assemblyIncluded in your JDK installation — no separate install needed.
Chrome / ChromiumlatestRuntimeSee auto-detection paths below. Docker images bundle Chromium via apk add chromium.
Ruststable (edition 2021)CLI build onlyOnly needed when building browser4-cli from source (not needed for the Java backend).
Node.js + pnpmNode 24 / pnpm 10CLI distributionOnly needed when packaging the CLI for npm publish.

Platform-specific tools for runtime bundle assembly

PlatformAdditional tools
Linuxtar, wget or curl
macOStar
Windowspowershell.exe (built-in) — Windows PowerShell 5.1+ is sufficient

Chrome Setup

Auto-detection paths

PlatformSearch paths
WindowsC:\Program Files\Google\Chrome\Application\chrome.exe, C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
macOS/Applications/Google Chrome.app/Contents/MacOS/Google Chrome, /Applications/Chromium.app/Contents/MacOS/Chromium
Linux/opt/google/chrome/chrome, /usr/bin/google-chrome, /usr/bin/chromium-browser, PATH: google-chrome, chromium-browser, chromium

Automatic installation

If Chrome is not found, the CLI attempts automatic installation:

  • Windows: via winget or PowerShell download of the standalone installer
  • Debian/Ubuntu: via wget/curl + sudo dpkg -i
  • RHEL/Fedora: via curl + sudo dnf install -y
  • macOS: prints brew install --cask google-chrome instructions

Build Steps

  1. Clone the repository

    git clone https://github.com/platonai/Browser4.git
    cd Browser4
    
  2. Configure your LLM API key

    Edit application.properties and add your API key, or set environment variables. See LLM Configuration for supported providers and variable names.

  3. Build the project

    ./mvnw -DskipTests
    

Building the CLI

The CLI (browser4-cli) is a Rust binary that communicates with the Browser4 backend. It requires Rust (stable, edition 2021) — see the prerequisites table above.

Running without installing (recommended for development):

# From the repo root:
cargo run --manifest-path cli/browser4-cli/Cargo.toml -- <command>

# Or from the CLI directory:
cd cli/browser4-cli
cargo run -- <command>

The backend server starts automatically on first use (no manual ./mvnw required).

Building the release binary:

cd cli/browser4-cli
cargo build --release
# Binary at: target/release/browser4-cli[.exe]

Installing globally:

cd cli/browser4-cli
cargo install --path .
# Now available as: browser4-cli <command>