Skip to content

Building

Chokri Hammedi edited this page Apr 21, 2026 · 1 revision

Building

Rosemary uses a single build.sh script to cross-compile both the server and agent for all supported platforms and architectures.


Requirements

  • Go 1.25 or later
  • GOTOOLCHAIN=auto is set by the build script automatically
  • CGO_ENABLED=0 no C dependencies, fully static binaries
  • For Windows server builds: WinDivert.dll and WinDivert64.sys must be present in rosemary/ before building

Clone and Build

git clone https://github.com/blue0x1/rosemary.git
cd rosemary
bash build.sh

Output binaries are placed in dist/.


Build Script Usage

bash build.sh [target] [os] [arch]
Argument Options Default
target rosemary, agent, all all
os linux, windows, darwin, freebsd, openbsd, all all
arch amd64, arm64, arm, 386, all all

Examples

# Build everything
bash build.sh

# Build server only for Linux amd64
bash build.sh rosemary linux amd64

# Build agent only for Windows
bash build.sh agent windows amd64

# Build all targets for macOS
bash build.sh all darwin all

Supported Targets

OS Architectures
Linux amd64, arm64, arm, 386
Windows amd64, arm64, 386
macOS amd64, arm64
FreeBSD amd64, arm64, arm, 386
OpenBSD amd64, arm64, arm, 386

ARM 32-bit builds use GOARM=7.


Output Naming

dist/rosemary-<os>-<arch>
dist/rosemary-<os>-<arch>.exe   (Windows)
dist/agent-<os>-<arch>
dist/agent-<os>-<arch>.exe      (Windows)

Size Checks

The build script checks minimum binary sizes after each build:

Binary Minimum size
rosemary (server) 8 MB
agent 4 MB

A warning is printed if a binary is suspiciously small, which may indicate an incomplete or failed build.


Windows Server: WinDivert

The Windows server build embeds WinDivert.dll and WinDivert64.sys directly into the binary. They are extracted to a temporary directory at runtime.

Before building the Windows server target, place both files in the rosemary/ directory:

  1. Download WinDivert v2.x (64-bit) from the official source
  2. Copy WinDivert.dll and WinDivert64.sys into rosemary/
  3. Run the build

go install

Alternatively, install directly without cloning:

go install github.com/blue0x1/rosemary/rosemary@latest
go install github.com/blue0x1/rosemary/agent@latest

For sudo use, copy to the system path:

sudo cp ~/go/bin/rosemary /usr/local/bin/

Clone this wiki locally