Skip to content

Latest commit

 

History

History
397 lines (339 loc) · 21.8 KB

installation.md

File metadata and controls

397 lines (339 loc) · 21.8 KB

Install, update, and uninstall the provider

Last updated: 2026-11-18

How to put the darkbloom CLI on an Apple Silicon Mac with scripts/install.sh, what the script verifies before it touches an existing install, how the binary is updated afterwards, and how to remove everything. For anyone installing Darkbloom; after it, darkbloom --opencode sets up OpenCode on this Mac's models (quickstart).

Prerequisites

  • An Apple Silicon Mac. The binary targets macOS 14 (provider-swift/Package.swift, .macOS(.v14)); the installer checks uname = Darwin and uname -m = arm64, and refuses a new install below macOS 27 (see step 1/5). Sizing (RAM, disk, which models fit) is in hardware requirements.
  • Serving requires macOS 27 or later and current qualified App Attest authorization, not just a successful install or OS upgrade. An old Darkbloom enrollment profile does nothing.
  • Outbound HTTPS to the coordinator (https://api.darkbloom.dev).
  • No sudo. The script writes to ~/.darkbloom, appends one PATH line to ~/.zshrc (or ~/.bashrc), and tries — best effort, no prompt — to link /usr/local/bin/darkbloom.

Steps

1. Run the installer

curl -fsSL https://api.darkbloom.dev/install.sh | bash

The coordinator serves scripts/install.sh at /install.sh with its own base URL substituted for the __DARKBLOOM_COORD_URL__ placeholder; the embedded copy coordinator/api/install.sh is regenerated byte-for-byte by scripts/sync-install-embed.sh. To run the script from a checkout, set the placeholder yourself: COORD_URL=https://api.darkbloom.dev bash scripts/install.sh.

The script performs these actions in order (scripts/install.sh; failures exit 1 and are listed in troubleshooting):

  1. Preflight. Aborts unless uname is Darwin and uname -m is arm64. Prints chip (sysctl machdep.cpu.brand_string), RAM (hw.memsize) and macOS version (sw_vers).

  2. Step 1/5 — release metadata. GET $COORD_URL/v1/releases/latest, then extracts url, bundle_hash, binary_hash, metallib_hash, version, backend with sed. Missing url, bundle_hash or version aborts. require_supported_macos then stops a new install on macOS 26 or earlier with an upgrade prompt (System Settings › General › Software Update) before anything is downloaded. A Mac that already has the CLI or a provider config (a grandfathered provider reinstalling or repairing) continues with a notice to upgrade; an unknown OS version is not guessed.

  3. Step 2/5 — download and verify. Creates ~/.darkbloom and ~/.darkbloom/bin, downloads the tarball to /tmp/darkbloom-bundle.tar.gz and requires shasum -a 256 to equal bundle_hash (mismatch deletes the file and aborts). install_bundle_atomically then:

    • extracts into ~/.darkbloom/.install-staging-<pid>-<random>;
    • requires bin/darkbloom, bin/darkbloom-enclave, bin/mlx.metallib;
    • hashes bin/darkbloom against binary_hash and bin/mlx.metallib against metallib_hash (verify_file_hash; a hash the release record omits is skipped);
    • when the tarball contains Darkbloom.app: verify_staged_app_payload (both hashes are then mandatory and Contents/MacOS/darkbloom and Contents/MacOS/mlx.metallib are re-hashed) and verify_staged_app: codesign --verify --deep --strict -R="$DARKBLOOM_DESIGNATED_REQUIREMENT" where the requirement is anchor apple generic and identifier "io.darkbloom.provider" and certificate leaf[subject.OU] = "SLDQ2GJ6TL" and certificate leaf = H"95b67556e04653f56ba5411d20d33dd263ef6e2a" (the team and the signing certificate); the fan-helper triple (darkbloom-fan-helper-v1 string in the binary ⇔ marker Contents/Resources/darkbloom-runtime-capabilities/fan-helper-v1 = 1 ⇔ Contents/Helpers/darkbloom-fan-helper present, a regular file, mode 0755, signed to anchor apple generic and identifier "io.darkbloom.fan-helper" and certificate leaf[subject.OU] = "SLDQ2GJ6TL" and certificate leaf = H"95b67556e04653f56ba5411d20d33dd263ef6e2a"); the paged-kernel pair (engine_v2_kv_backend string in the binary ⇔ marker paged-kernel-v1 = 1, plus exactly one non-empty Contents/Resources/mlx-swift-lm_MLXLMCommon.bundle/pagedattention.metal); and a runtime smoke test: DARKBLOOM_NO_UPDATE_CHECK=1 DARKBLOOM_GEMMA4_PREFILL_CHUNK_EVAL=18 MLX_GEMMA4_FUSED_WEIGHTED_UNSORT=1 MLX_GATHER_QMM_EXPERT_SLICES=1 darkbloom runtime-smoke (provider-swift/Sources/darkbloom/RuntimeSmokeCommand.swift, RuntimeSmoke);
    • commit_staged_app moves any existing ~/.darkbloom/Darkbloom.app to ~/.darkbloom/.install-backup-<pid>-<random>, moves the staged app in, writes the symlinks ~/.darkbloom/bin/darkbloom, darkbloom-enclave, mlx.metallib → ../Darkbloom.app/Contents/MacOS/*, and chmod +x. Any failure moves the backup back;
    • a tarball without Darkbloom.app (the retired flat layout) is refused;
    • the staging directory is removed; on any failure the script prints Existing installation was left unchanged. and exits 1.
  4. PATH. ln -sf ~/.darkbloom/bin/darkbloom /usr/local/bin/darkbloom (errors ignored). The rc file is ~/.zshrc, or ~/.bashrc only when ~/.zshrc does not exist. If the rc does not already mention .darkbloom/bin, lines referencing .dginf/bin, .eigeninference/bin, alias eigeninf, alias dginf, # EigenInference and # Darkbloom are deleted and # Darkbloom + export PATH="$HOME/.darkbloom/bin:$PATH" is appended; the rc is then sourced.

  5. Config location and coordinator. The CLI reads only ~/.config/darkbloom/provider.toml or an explicit --config path (provider-swift/Sources/ProviderCore/Config/ProviderConfig.swift, defaultConfigPath); retired ~/.dginf / ~/.eigeninference installs are not migrated. bind_provider_coordinator binds the provider to the coordinator that served the installer and keeps every other line of the file:

    • when $COORD_URL is https://api.darkbloom.dev, it removes any url line under [coordinator], so the provider uses its built-in production default. It does not create the file when it is missing;
    • for any other coordinator, it writes url = "wss://<host>/ws/provider" under [coordinator] and creates the file when it is missing (ws:// only for http://localhost or http://127.0.0.1; any other scheme, a path, or a character outside A-Za-z0-9.- and :port stops the install).

    A provider that is already running keeps its old coordinator until darkbloom start.

  6. Step 3/5 — Secure Enclave identity. Runs darkbloom-enclave info (provider-swift/Sources/darkbloom-enclave-cli/EnclaveCLI.swift), which creates the P-256 key if missing. Failure prints a warning; the install continues with reduced trust (see attestation).

  7. Step 4/5 — verification setup. configure_device_verification uses the local sw_vers major version. Darkbloom verifies Macs with App Attest only, so it never downloads or opens a profile. On macOS 27 or later it directs the user to login/start/status for App Attest approval; on older macOS it says the Mac cannot serve until macOS is updated. It reads profiles status -type enrollment only to point at darkbloom unenroll (choice 2) when the old Darkbloom enrollment profile is still installed (one line; the read needs no privileges); an employer's profile gets no such line. Setup choice grants no serving authorization; see the authorization contract.

  8. Step 5/5 — catalog. GET $COORD_URL/v1/models/catalog?type=text; interactive runs print up to 20 entries. Nothing is downloaded.

  9. Done. It prints the version, the command and what to run next. Every command it prints uses the installed identity's name (darkbloom-dev for a DevNet build).

2. Open a new shell

exec $SHELL -l    # or open a new Terminal window

The PATH line the installer added is read only by a new shell. Until then, darkbloom is found only where the /usr/local/bin link was made, and ~/.darkbloom/bin/darkbloom always works.

3. Start Darkbloom

darkbloom --opencode            # or --hermes, or plain darkbloom start for neither

It asks nothing about how this Mac serves: a first start serves Both (Darkbloom, and your local API beside it; Darkbloom keeps serving while you use the Mac) and saves it, asks which models to serve and sets OpenCode up. darkbloom local serves only you instead. The quickstart walks through each choice, including linking your account to earn on the Darkbloom network.

Verify

darkbloom --version          # prints ProviderCore.version, e.g. 0.8.16
ls -l ~/.darkbloom/bin       # symlinks into ../Darkbloom.app/Contents/MacOS/
codesign --verify --deep --strict \
  -R='anchor apple generic and identifier "io.darkbloom.provider" and certificate leaf[subject.OU] = "SLDQ2GJ6TL" and certificate leaf = H"95b67556e04653f56ba5411d20d33dd263ef6e2a"' \
  ~/.darkbloom/Darkbloom.app && echo signature OK

darkbloom doctor checks the machine for serving the Darkbloom network: its hardware, account link, verification and the coordinator (doctor checks). Only me needs none of the network checks.

Update

Manual

darkbloom update --check-only     # report only
darkbloom update                  # download, verify, atomic replace, restart the service

darkbloom update (provider-swift/Sources/darkbloom/UpdateCommand.swift, Update) drives SelfUpdater (provider-swift/Sources/ProviderCore/Update/SelfUpdater.swift): it fetches GET {coordinator}/v1/releases/latest?platform=macos-arm64, verifies the SHA-256 of the bundle and, when published, of the binary and mlx.metallib, verifies the code signature (production always constructs the updater with verifyCodeSignatures: true), requires the signed app's CFBundleShortVersionString to equal the release's version exactly (the coordinator's version only labels the bundle, so an older signed build under a newer label is refused), replaces the install, registers the new Darkbloom.app with macOS LaunchServices (LSRegisterURL; App Attest reports is_supported_false while LaunchServices still describes the replaced bundle, see attestation), and — if the LaunchAgent is loaded — restarts it via ProcessLifecycle.restartAfterUpdate(). Flags: --check-only, --override-quarantine, --coordinator <url>, --config.

Automatic

provider.auto_update (default true, provider-swift/Sources/ProviderCore/Config/ProviderConfig.swift) is toggled with darkbloom autoupdate enable|disable|status (provider-swift/Sources/darkbloom/AutoUpdateCommand.swift). When enabled the daemon checks once at start (runStartupAutoUpdate, provider-swift/Sources/darkbloom/Start/StartCommand+Modes.swift) and then on a loop (provider-swift/Sources/ProviderCore/ProviderLoop+AutoUpdate.swift):

Step Symbol
First in-daemon check after start autoUpdateInitialDelay
Check interval autoUpdateInterval
Random delay before installing up to provider.update_jitter_seconds (updateJitterSeconds)
Drain of in-flight requests before restart updateDrainTimeout
Skip every check (banner, start, loop, watchdog) DARKBLOOM_NO_UPDATE_CHECK set to any value

The values are in cli-reference.md (the jitter default in its provider.toml table).

A freshly installed version that crashes rollbackThreshold times before surviving defaultStabilizationSeconds is quarantined on this machine (provider-swift/Sources/ProviderCore/Update/UpdateRecoveryState.swift; values in runtime constants). Only that exact version is blocked; a newer release installs normally. darkbloom update --override-quarantine reinstalls it anyway, and darkbloom doctor reports the quarantine under up to date.

Roll back to the previous release

When the updater installs a release, it keeps the signed release it replaced in ~/.darkbloom/recovery/predecessor/ (provider-swift/Sources/ProviderCore/Update/UpdateInstallLayout.swift, snapshotLiveAsPredecessor). install.sh keeps none. On a darkbloom cluster Mac, the cluster service removes the kept release at its next start once an install outside the updater has changed the app, so the next rollback needs the next update (an install outside the updater). A Mac that is not a cluster Mac does not check its record yet. When install.sh replaces a release that the updater installed and has not promoted yet, the watchdog (WatchdogRecoveryService) takes the healthy provider for that pending release. Each check past its startup window (at least 300 s) counts as a failed start and restarts the serving provider; at the third, the watchdog restores whatever the kept copy holds (possibly an older release than the one install.sh installed), quarantines the pending release and restarts on the copy. Reinstall only once the pending release is promoted (after defaultStabilizationSeconds of healthy running). A release that runs but regresses can be rolled back to the kept release on one Mac, with automatic updates left on:

  1. On a Mac that serves in a darkbloom cluster pair, first stop its cluster service with darkbloom cluster stop --service, roll it back, then start it again with darkbloom cluster. The other Mac follows the rollback to the same release by itself (the pair's coordinated update). For a cluster-member provider service, stop it with darkbloom stop and roll back both Macs. The command refuses while the pair serves.

  2. Run the rollback and answer y:

    darkbloom update --rollback

    It prints the installed and restored versions first and changes nothing until you confirm (--yes skips the question). The running provider finishes its accepted requests (--timeout, as for darkbloom update), the kept release replaces the installed one in one journaled swap, and the provider restarts on it. The installed release is quarantined: the provider's own checks, the startup check and the watchdog skip it, and the next newer release installs normally.

Only one earlier release is kept, so a second rollback is refused. To install the rolled-back release again, run darkbloom update --override-quarantine.

Verify:

darkbloom --version                 # the restored version
darkbloom update --check-only       # while vX is the latest: "Latest release vX is quarantined on this machine."

Refusals and flags are listed in the darkbloom update reference.

If the watchdog exits after starting a candidate but before recording the launch receipt, its next health observations reconcile the saved intent with launchd's run count or process identity for the same job. For each comparison, both saved and current values must be known; either a higher run count or a changed process identity proves a launch. A proven launch receives the existing startup timeout from reconciliation; repeated observations do not extend it. Missing or unchanged evidence preserves the intent for a later observation without arming a failed-start timeout. This includes a health observation before restart and a previously unreadable process identity becoming available without other evidence of a launch. This also covers a candidate that remains running without a heartbeat (provider-swift/Sources/ProviderCore/Service/WatchdogRecoveryService.swift, observeHealthyProvider).

A restart you ask for before the release is promoted (darkbloom restart, or stop then start) is never a failed start: the stopped provider records in provider-run.json that it was asked to stop, and the startup timeout then runs from the start of the next process launchd runs (startupWindowStart). The provider's own restart into an update counts the same way. After a crash, a hang, a reboot, a kill or any other stop, the timeout still runs from the release's launch, whatever started the provider again, and so it does after a --force stop that had to kill the provider before it recorded its stop. A restarted process that sends no heartbeat within its own window still counts too. A release restarted more often than every 10 minutes is never promoted: the watchdog logs a warning in ~/.darkbloom/watchdog.log at its 5th, 10th, 20th, 40th… restart (darkbloom update).

The unprivileged updater never touches the root fan helper; after an update run sudo darkbloom fan enable again if you use fan control.

If the provider job disappears between the watchdog's loaded check and kickstart, the watchdog leaves it unloaded and reports that no restart occurred. A crash-loop backend guard staged for that attempt is rolled back to its previous state; an existing guard remains intact (provider-swift/Sources/ProviderCore/Service/LaunchAgent.swift, kickstartIfLoaded; provider-swift/Sources/ProviderCore/Service/WatchdogRecoveryService.swift, recoverDownProvider). Use darkbloom start to start a stopped provider.

Two Macs as one provider

Two Macs joined by a Thunderbolt 5 cable are set up once with darkbloom cluster on each Mac: see two-mac-cluster.md (one command on each Mac: darkbloom cluster; no SSH, no network settings typed).

Uninstall

One command takes Darkbloom off this Mac. In a terminal it shows two choices with this Mac's sizes and reads one key (Esc cancels):

darkbloom uninstall
  1. Remove everything. The app, settings, pairing, logs and all models. It asks once more, with the size of the models it deletes; only y goes on.
  2. Keep models. Removes everything else; a reinstall reuses the models.

Run it as yourself, not with sudo: it refuses to run as root, and macOS asks for the password when a step needs it.

Both choices stop serving (the drain of darkbloom stop), stop this Mac's part of a two-Mac pair (also when its cluster service runs without a login agent; while one it can't stop runs, nothing is deleted), remove every Darkbloom background service, revoke this Mac's account token, forget the pairing, undo the cable port setup (macOS asks for an administrator's password) and delete ~/.config/darkbloom, ~/Library/Caches/darkbloom, the /usr/local/bin/darkbloom link and ~/.darkbloom, which holds the app, logs and pairing. Remove everything also deletes the models Darkbloom downloaded into ~/.cache/huggingface/hub and the cluster model store. Keep models leaves them where they are: after reinstalling, darkbloom start or darkbloom cluster finds them without downloading. The summary lists each step as done, skipped or failed, what was kept and where, and the space freed. If the cable port setup could not be undone, ~/.darkbloom stays so you can run it again.

For scripts and agents:

darkbloom uninstall --keep-models --dry-run   # every action and path, with sizes; changes nothing (--json too)
darkbloom uninstall --keep-models --yes
darkbloom uninstall --everything --yes

No choice deletes a models folder you chose or the cluster model store beside it, even inside ~/.darkbloom (the rest of that folder goes), caches in a folder you chose, anything that resolves outside Darkbloom's folders, or Keychain keys (a new install replaces them). With both the production Darkbloom and Darkbloom Dev on this Mac, uninstalling one removes only its own pairing and cluster setup and keeps this Mac's cable port setup, which the other may use; uninstall that one too to undo it. Remove what it leaves first, if you use it:

sudo darkbloom fan uninstall   # fan control: restores macOS automatic control
darkbloom sandbox uninstall    # Darkbloom Sandbox
darkbloom unenroll             # choice 2: the old Darkbloom enrollment profile
darkbloom cluster gpu-limit --undo  # only if you raised the GPU limit with it; asks for approval

Then remove the # Darkbloom PATH line from your rc file by hand. On a paired Mac, run darkbloom uninstall on the other Mac too, or darkbloom cluster on it to pair it with another Mac. darkbloom stop --uninstall still removes only the provider, watchdog and desktop API agents and keeps every file. Every flag, step and path rule is in the CLI reference.

darkbloom cluster gpu-limit --undo (provider-swift/Sources/darkbloom/ClusterGPULimitCommand.swift) removes the root boot job com.layrlabs.glm53-wired-limits and returns the GPU limit to the macOS default (GPU memory limit for a GLM pair). Neither darkbloom uninstall nor darkbloom stop --uninstall removes that job.

Related