bots-garden/razorbillpublic Fork
⑂ main
Commits
⬇ Clone ▾
git clone https://git.rickub.com/bots-garden/razorbill.git
git clone ssh://git@rickub.com/bots-garden/razorbill.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Download ZIP
🛟 Updated. 872a940 · on main · k33g · 3h ago
build-on-the-mac.md · 71 lines · 3.8 KBmarkdown
Blame HistoryOpen raw

How to build rzb on the Mac

This guide builds the rzb executable, the server, from the sources. It assumes a Mac with Apple Silicon and the repository cloned.

Prerequisites

  1. macOS 14 or later, Apple Silicon (M1 or later).

  2. Xcode 26 or later. xcode-select -p must print a path inside Xcode.app; if it prints /Library/Developer/CommandLineTools, run sudo xcode-select -s /Applications/Xcode.app.

  3. The Metal toolchain, once per Xcode install:

    xcodebuild -downloadComponent MetalToolchain
    

Build

From the repository root:

xcodebuild build -scheme razorbill -destination 'platform=macOS' -configuration Release \
  -derivedDataPath .build/xcode -skipPackagePluginValidation -skipMacroValidation \
  CLANG_ENABLE_CODE_COVERAGE=NO CLANG_COVERAGE_MAPPING=NO

The executable is .build/xcode/Build/Products/Release/rzb. Keep it in that folder (or put the folder on your PATH): the MLX Metal library, mlx-swift_Cmlx.bundle, sits next to it and is loaded at run time.

.build/xcode/Build/Products/Release/rzb version
# rzb 1.0.0 (engines: fake, mlx)

Install

To run rzb from any folder, build and install in one command:

scripts/install.sh
rzb version

It builds in Release (incrementally, in .build/xcode), copies rzb and its bundles to /usr/local/lib/razorbill, and writes /usr/local/bin/rzb, a two-line launcher that runs it from there; rzb cannot be copied alone into /usr/local/bin because it loads its bundles from its own folder. It asks for your password through sudo when /usr/local is not writable. Run it again after each git pull to update.

Option Effect
--no-build Install the last build without rebuilding.
--prefix <dir> Install under <dir>/lib/razorbill and <dir>/bin instead of /usr/local (e.g. ~/.local, no sudo).
--uninstall Remove what the script installed.

The script never overwrites or removes an rzb launcher it did not write.

Variants

  • Debug build: replace -configuration Release with -configuration Debug; the executable is then in Build/Products/Debug. Generation is much slower.
  • List the schemes: xcodebuild -list. The package has a single scheme, razorbill; rzb and razorbill-Package do not exist.
  • Archive to distribute: see Package and publish a release.
  • From a Linux sandbox: see Develop from a Linux sandbox.

Troubleshooting

Symptom Fix
The build fails while compiling MLX's Metal shaders (the metal tool is missing) Run xcodebuild -downloadComponent MetalToolchain.
Operation not permitted or can't write output file under .build/xcode A build ran with sudo and left files owned by root. Run sudo chown -R "$(whoami)" .build, then build again without sudo (scripts/install.sh asks for it itself, only to copy).
release.sh: tar: Failed to open 'dist/…tar.gz' or dist/… is not writable An earlier release.sh ran with sudo and left dist/ owned by root. Run sudo chown -R "$(whoami)" dist .build, then run scripts/release.sh again without sudo.
A default.profraw file appears in the folder where rzb ran rzb was built without CLANG_ENABLE_CODE_COVERAGE=NO CLANG_COVERAGE_MAPPING=NO: the package scheme gathers test coverage and instruments the Release build too. Rebuild with the command above (or scripts/install.sh) and delete the file.
Failed to load the default metallib when a model loads rzb was built with swift build, or copied away from mlx-swift_Cmlx.bundle. Build with xcodebuild as above and run it from Build/Products/Release.

See also

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# How to build rzb on the Mac

This guide builds the `rzb` executable, the server, from the sources. It assumes a Mac with Apple Silicon and the repository cloned.

## Prerequisites

1. macOS 14 or later, Apple Silicon (M1 or later).
2. Xcode 26 or later. `xcode-select -p` must print a path inside `Xcode.app`; if it prints `/Library/Developer/CommandLineTools`, run `sudo xcode-select -s /Applications/Xcode.app`.
3. The Metal toolchain, once per Xcode install:

   ```bash
   xcodebuild -downloadComponent MetalToolchain
   ```

## Build

From the repository root:

```bash
xcodebuild build -scheme razorbill -destination 'platform=macOS' -configuration Release \
  -derivedDataPath .build/xcode -skipPackagePluginValidation -skipMacroValidation \
  CLANG_ENABLE_CODE_COVERAGE=NO CLANG_COVERAGE_MAPPING=NO
```

The executable is `.build/xcode/Build/Products/Release/rzb`. Keep it in that folder (or put the folder on your `PATH`): the MLX Metal library, `mlx-swift_Cmlx.bundle`, sits next to it and is loaded at run time.

```bash
.build/xcode/Build/Products/Release/rzb version
# rzb 1.0.0 (engines: fake, mlx)
```

## Install

To run `rzb` from any folder, build and install in one command:

```bash
scripts/install.sh
rzb version
```

It builds in Release (incrementally, in `.build/xcode`), copies `rzb` and its bundles to `/usr/local/lib/razorbill`, and writes `/usr/local/bin/rzb`, a two-line launcher that runs it from there; `rzb` cannot be copied alone into `/usr/local/bin` because it loads its bundles from its own folder. It asks for your password through `sudo` when `/usr/local` is not writable. Run it again after each `git pull` to update.

| Option | Effect |
| --- | --- |
| `--no-build` | Install the last build without rebuilding. |
| `--prefix <dir>` | Install under `<dir>/lib/razorbill` and `<dir>/bin` instead of `/usr/local` (e.g. `~/.local`, no `sudo`). |
| `--uninstall` | Remove what the script installed. |

The script never overwrites or removes an `rzb` launcher it did not write.

## Variants

- **Debug build**: replace `-configuration Release` with `-configuration Debug`; the executable is then in `Build/Products/Debug`. Generation is much slower.
- **List the schemes**: `xcodebuild -list`. The package has a single scheme, `razorbill`; `rzb` and `razorbill-Package` do not exist.
- **Archive to distribute**: see [Package and publish a release](package-a-release.md).
- **From a Linux sandbox**: see [Develop from a Linux sandbox](develop-from-a-sandbox.md).

## Troubleshooting

| Symptom | Fix |
| --- | --- |
| The build fails while compiling MLX's Metal shaders (the `metal` tool is missing) | Run `xcodebuild -downloadComponent MetalToolchain`. |
| `Operation not permitted` or `can't write output file` under `.build/xcode` | A build ran with `sudo` and left files owned by root. Run `sudo chown -R "$(whoami)" .build`, then build again without `sudo` (`scripts/install.sh` asks for it itself, only to copy). |
| `release.sh`: `tar: Failed to open 'dist/…tar.gz'` or `dist/… is not writable` | An earlier `release.sh` ran with `sudo` and left `dist/` owned by root. Run `sudo chown -R "$(whoami)" dist .build`, then run `scripts/release.sh` again without `sudo`. |
| A `default.profraw` file appears in the folder where `rzb` ran | `rzb` was built without `CLANG_ENABLE_CODE_COVERAGE=NO CLANG_COVERAGE_MAPPING=NO`: the package scheme gathers test coverage and instruments the Release build too. Rebuild with the command above (or `scripts/install.sh`) and delete the file. |
| `Failed to load the default metallib` when a model loads | `rzb` was built with `swift build`, or copied away from `mlx-swift_Cmlx.bundle`. Build with `xcodebuild` as above and run it from `Build/Products/Release`. |

## See also

- Why `xcodebuild` and not `swift build`: [architecture](../explanation/architecture.md#why-the-mac-build-uses-xcodebuild).
- Running the tests: [Run the tests](run-the-tests.md).