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
-
macOS 14 or later, Apple Silicon (M1 or later).
-
Xcode 26 or later.
xcode-select -pmust print a path insideXcode.app; if it prints/Library/Developer/CommandLineTools, runsudo xcode-select -s /Applications/Xcode.app. -
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 Releasewith-configuration Debug; the executable is then inBuild/Products/Debug. Generation is much slower. - List the schemes:
xcodebuild -list. The package has a single scheme,razorbill;rzbandrazorbill-Packagedo 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
- Why
xcodebuildand notswift build: architecture. - Running the tests: Run the tests.
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 |
|