---
title: "Building from Source"
description: "Clone the base/base repository and compile binaries with Just recipes or Cargo."
source: https://basehub.org/getting-started/building/
---
Building `base/base` from source means cloning the repository and compiling one or more workspace targets with Just or Cargo. Install all [prerequisites](/getting-started/prerequisites/) before continuing.

## Clone the Repository

```bash
git clone https://github.com/base/base.git
cd base
```

## How the Build Recipes Are Organised

Build work sits in a Just module rather than in top-level recipes. You reach it by naming the module first, then the recipe:

```bash
just build release
```

Running `just build` on its own prints the recipe list instead of compiling anything. That is the module default. To see what is available:

```bash
just build
```

## Standard Release Build

This is the usual command. It produces an optimized binary for every binary target in the workspace:

```bash
just build release
```

It wraps `cargo build --workspace --release`, and the results land in `target/release/`.

`release` is the profile you want for day-to-day work, and it is what `docker-bake.hcl` falls back to when nothing sets `PROFILE`. The workspace also keeps `maxperf`, which inherits `release` and then switches to fat LTO with a single codegen unit. Base reserves it for the artifacts it publishes, so reaching for it locally mostly buys you a much longer compile. Every profile is listed under [build profiles](/node-operations/configuration/#build-profiles).

## Building Individual Targets

To compile only the node binary:

```bash
just build node
```

Be aware that this recipe is a debug build — it maps to `cargo build --bin base-reth-node` with no profile flag. For an optimized single binary, call Cargo yourself:

```bash
cargo build --release --bin base-reth-node
```

That writes to `target/release/base-reth-node`.

## Building Solidity Test Contracts

Some crates need compiled Solidity contracts before their tests will run. Build them with:

```bash
just build contracts
```

The recipe changes into `crates/utilities/test-utils/contracts`, pulls dependencies with `forge soldeer install`, and runs `forge build`. [Foundry](/getting-started/prerequisites/#foundry) must be installed first.

## Debug Build (All Targets)

For an unoptimized build of every target in the workspace, including tests and benches:

```bash
just build all-targets
```

This one depends on `contracts` and `elfs`, so both are built for you first. Compilation is much quicker than a release build and the binaries are correspondingly slower. Reach for it while iterating.

## CI-Profile Builds

Two recipes mirror what continuous integration does. Both use the `ci` profile, which is tuned for fast GitHub Actions runs and small `target` directories:

```bash
# Every target in the workspace
just build ci

# Only the crates affected by your branch
just build affected-ci
```

`affected-ci` compares against `main` by default. Pass another ref to compare against it instead — `just build affected-ci origin/develop`. When nothing is affected it reports so and exits without building.

## SP1 ELF Builds

Proving work needs its SP1 ELFs compiled:

```bash
just build elfs
```

This delegates to `just succinct build-elfs`.

## Build Artifacts

| Command | Profile | Output |
|---|---|---|
| `just build release` | release | `target/release/*` |
| `just build node` | debug | `target/debug/base-reth-node` |
| `just build all-targets` | debug | `target/debug/*` |
| `just build ci` | ci | `target/ci/*` |
| `just build affected-ci` | ci | `target/ci/*` (affected crates only) |
| `just build contracts` | N/A (Foundry) | Solidity artifacts in `crates/utilities/test-utils/contracts/out/` |
| `just build elfs` | N/A (SP1) | Compiled SP1 ELFs |

## Troubleshooting

**Linker errors mentioning `clang` or `llvm`** -- Install `libclang-dev` (Debian/Ubuntu) or make sure Xcode Command Line Tools are installed (macOS).

**Out of memory during linking** -- Release builds use link-time optimization, which can consume a lot of RAM. Close other memory-heavy applications or add swap space. You can also reduce parallelism:

```bash
CARGO_BUILD_JOBS=2 just build release
```

**Stale Solidity artifacts** -- If contract tests fail after pulling new changes, re-run `just build contracts` to recompile.

**`just build` did nothing** -- That prints the module's recipe list. Name a recipe after it, such as `just build release`.

Once the build completes, continue to [Running the Node](/getting-started/running/) or [Docker Builds](/getting-started/docker/).
