Set up a Mac for a Federated Core, like CoreDesktop's configure

A macOS counterpart of CoreDesktop's configure, with the same drop-in
items in configure.d/:

- core: Mail, Calendar and Contacts through a configuration profile,
  Superpanel as an app, Nextcloud files through the Nextcloud app, and
  Element; with test-and-fix, password change and removal
- tailscale: join the Core's network through headscale
- backup: restic to Nextcloud through rclone, run by launchd through an
  app that can be given Full Disk Access
- storage: SMB shares mounted the way Finder does, again at login and
  on network changes
- agents, claude, opencode, hermes, sandbox: install the agents and run
  them in Anthropic's sandbox runtime (Seatbelt on macOS)
- ai-servers: LLM servers on this Mac or the network, for the agents

Apps and tools macOS lacks are offered for download, checked against
their makers' Team IDs and notarization, or published SHA-256 sums.
Everything runs on macOS' bash 3.2 with only built-in tools.

smoketest/ runs scenarios in fresh macOS VMs with Tart.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-11 08:34:42 -07:00
co-authored by Claude Opus 5.5
commit 08e6b2ee4f
45 changed files with 4517 additions and 0 deletions
+54
View File
@@ -0,0 +1,54 @@
#!/bin/bash
#
# Purpose : Read and edit JSON for configure.d items. Source this file.
#
# macOS has no jq before macOS 15, and python3 needs the Command Line Tools,
# so this uses JavaScript for Automation (osascript -l JavaScript), which
# every macOS has. Expressions are JavaScript; the JSON is "d", and any
# arguments after the expression are a[0], a[1], ... so values never have to
# be pasted into the code.
# json_get <expression> [args...] < file.json
# Prints the expression's value: strings as they are, anything else as JSON.
# Fails if the input isn't JSON, or the value is undefined, null, false or "".
# shellcheck disable=SC2016
json_get() {
osascript -l JavaScript -e '
function run(argv) {
ObjC.import("Foundation");
var data = $.NSFileHandle.fileHandleWithStandardInput.readDataToEndOfFile;
var text = $.NSString.alloc.initWithDataEncoding(data, $.NSUTF8StringEncoding).js;
var d = JSON.parse(text);
var v;
try {
v = (new Function("d", "a", "return (" + argv[0] + ");"))(d, argv.slice(1));
} catch (e) {
v = undefined;
}
if (v === undefined || v === null || v === false || v === "") throw new Error("no value");
return typeof v === "string" ? v : JSON.stringify(v);
}' "$@" 2> /dev/null
}
# json_edit <file> <statements> [args...]
# Runs JavaScript statements that change "d", the file's JSON, and saves it.
# A missing or empty file starts as {}. Leaves the file alone if it isn't
# valid JSON.
# shellcheck disable=SC2016
json_edit() {
local file="$1"
mkdir -p "$(dirname "$file")" || return 1
osascript -l JavaScript -e '
function run(argv) {
ObjC.import("Foundation");
var path = argv[0];
var s = $.NSString.stringWithContentsOfFileEncodingError(path, $.NSUTF8StringEncoding, null);
var text = s.isNil() ? "" : s.js;
var d = text.trim() === "" ? {} : JSON.parse(text);
(new Function("d", "a", argv[1]))(d, argv.slice(2));
var out = $(JSON.stringify(d, null, 2) + "\n");
if (!out.writeToFileAtomicallyEncodingError(path, true, $.NSUTF8StringEncoding, null)) {
throw new Error("could not write " + path);
}
}' "$@" > /dev/null 2>&1 || { echo "Couldn't change $file; is it valid JSON?"; return 1; }
}