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>
12 KiB
Federated Connector for macOS
Sets up a Mac for your Federated Core, using the apps macOS comes with: Mail, Calendar and Contacts. It's the macOS counterpart of CoreDesktop's configure, and works the same way: it shows what's set up, sets up the rest, and can test and fix a Core later.
Requirements
- macOS 13 (Ventura) or later, on Apple silicon or Intel.
- Nothing else. It runs with the bash macOS comes with and only uses tools that are part of macOS. It doesn't need Homebrew, jq, python or the Command Line Tools.
Running it
./configure # show what's set up and choose what to set up
./configure core # set up one item
./configure --list # show what's set up, and the item names
To run it as just configure, link it into a directory on your PATH, e.g. ln -s "$PWD/configure" /usr/local/bin/configure.
What it sets up
-
Your Federated Core. Give it your Superpanel's address (e.g. https://superpanel.example.com), your Core email, name and password. It sets up:
- Mail, Calendar and Contacts. It makes one configuration profile with your email account (IMAP and SMTP, with the settings your mail server publishes) and your Nextcloud calendars (CalDAV) and address books (CardDAV). This is how macOS itself sets up these accounts. macOS doesn't let scripts install profiles, so
configureopens the profile and System Settings, and you double-click "Federated Core (example.com)" under Downloaded and choose Install. To take the accounts off this Mac, remove the profile.- Mail keeps your Core password, because the mail server doesn't take Nextcloud app passwords.
- Calendar and Contacts use a Nextcloud app password, named "macOS Calendar and Contacts on {your Mac}", which you can revoke in Nextcloud under Settings > Security. A copy is kept in your login keychain, so the profile can be made again without a new app password.
- Superpanel as an app in ~/Applications (so it's in Launchpad and Spotlight) that opens Superpanel in your browser.
- Your Nextcloud files, kept in sync by the Nextcloud app. It opens with your Core's address filled in, and you sign in in your browser.
- Element, pointed at your Core's Matrix server, for your main Core.
You can add more Cores: run
configure coreagain and choose "Add a Core". Each Core gets its own profile, Superpanel and app password. Element, Tailscale and backups use your main Core (the first one, unless you choose another).configure corealso offers:- Test a Core: it checks each part against the Core and offers to fix what doesn't work.
- Your Core password changed: signing in with the new password turns Calendar's, Contacts' and the Nextcloud app's app passwords back on (Nextcloud turns them off when your password changes). Mail then gets the new password in a new version of the profile, which replaces the old one and keeps your mail.
- Remove a Core: it removes the profile, revokes the app password and deletes the Superpanel app. Everything on the Core itself stays as it is.
- Mail, Calendar and Contacts. It makes one configuration profile with your email account (IMAP and SMTP, with the settings your mail server publishes) and your Nextcloud calendars (CalDAV) and address books (CardDAV). This is how macOS itself sets up these accounts. macOS doesn't let scripts install profiles, so
-
Tailscale: joins this Mac to your Core's Tailscale network through headscale.example.com. To leave it, run
configure tailscaleagain. -
Backup: backs up your home folder daily to your Nextcloud files, in a
.backup-{this Mac's name}folder, with restic.- The backup is encrypted with a passphrase that
configureshows you once. Save it somewhere other than this Mac, such as Bitwarden. - It keeps 7 daily, 4 weekly and 6 monthly backups. It leaves out caches, things that can be downloaded again, VM disks, and files already in the cloud (iCloud Drive, your Nextcloud folder). To leave out more, list paths in
~/Library/Application Support/Federated Connector/backup-exclude, one per line. - restic reaches Nextcloud directly through rclone, with its own Nextcloud app password ("Federated Backup on {your Mac}").
- launchd starts it hourly and at login, and it backs up once a day, so a Mac that was asleep or off catches up soon after. It's started through a small app, "Federated Backup" in ~/Applications, because macOS only lets apps into Desktop, Documents, Mail and Photos once you give them Full Disk Access.
configureopens the right place in System Settings and checks that it worked. Without it, backups leave those folders out and you get a notification each time. - The log is
~/Library/Logs/Federated Connector/backup.log. Runconfigure backupagain to back up now or to turn backups off; turning them off also offers to delete the backups. - To restore, see "Restoring from a backup" below.
- The backup is encrypted with a passphrase that
-
Network storage: shared folders (SMB) from Windows PCs, NAS boxes and Macs with File Sharing on. It finds them on your network, or you enter an address (
smb://nas.local/files; leave out the share to choose from a list). macOS mounts them in /Volumes and shows them in Finder's sidebar, and its sign-in window can keep the password in your keychain. A launchd job mounts them again at login and when the network changes, skipping servers it can't reach. Folders over SSH (SFTP) need macFUSE, which this doesn't set up. -
AI agents: offers to install Claude Code, opencode and Hermes Agent with each one's own installer, and runs them in a sandbox (see below).
configure claude,configure opencodeandconfigure hermessign in to them and choose their model providers. -
Agent sandbox: iCloud Drive and other cloud drives' files are hidden from agents. Reading a file macOS keeps only in the cloud downloads it. To let agents read one of these, switch it here.
-
AI servers: LLM servers on this Mac or your network, such as Ollama or LM Studio. It finds the machines on your network over Bonjour and asks each one on the ports LLM servers use (11434 Ollama, 1234 LM Studio, 8080 llama.cpp, 8000 vLLM); or you enter an address. For the server you choose, it lets the sandboxed agents reach it (that port only), adds it to opencode with its models, offers to make it Hermes' model, and lets the commands Claude Code runs reach it too. A server on another machine has to accept connections from other machines: in Ollama's settings turn on "Expose Ollama to the network"; in LM Studio, "Serve on Local Network".
Sandboxed AI agents
opencode and Hermes run in Anthropic's sandbox runtime (srt), which on macOS uses Seatbelt, the same mechanism macOS uses to sandbox its own apps. In the sandbox, an agent:
- can change files only in the folder you start it in (plus its own settings, /tmp and a few package caches), so start it from a project folder
- can't read your SSH keys, keychains, password managers, browser profiles, Mail, Messages, Calendar and Contacts data, Signal, Element, cloud and Git credentials, or the other agents' logins
- can reach only AI providers and common developer sites: GitHub, Gitea, npm, PyPI, crates.io, RubyGems, the Go module proxy and Homebrew
Typing opencode, hermes or hermes-agent runs it in the sandbox: configure agents adds a line at the end of ~/.zshrc and ~/.bash_profile that puts sandbox/bin first on PATH. To run one without the sandbox, type unsandboxed opencode. Claude Code uses its own built-in sandbox for every command it runs, which configure agents turns on (see /sandbox inside Claude).
srt needs Node.js 22.12 or later. If this Mac doesn't have it, configure agents downloads Node.js and srt into ~/.local/share/federated-connector and uses them only for the sandbox.
To allow more, put a file in the same format as sandbox/config/base.json in ~/Library/Application Support/Federated Connector/sandbox/: base.json for every agent, or <agent>.json for one. Lists in it are added to the built-in ones. Domains in FEDERATED_SANDBOX_DOMAINS (space-separated) are allowed too.
Restoring from a backup
To see the backups and get files back:
source system/backup-env.sh
restic snapshots
restic restore latest --target ~/restored --include ~/Documents
On a new Mac, run configure core and configure backup first. Then name the old Mac's folder, and restic asks for the passphrase you saved:
source system/backup-env.sh .backup-{old Mac's name}
restic snapshots
Apps it downloads
If an app a step needs isn't on this Mac, configure offers to download and install it from its maker:
| App | For | From | Team ID |
|---|---|---|---|
| Nextcloud | Your files | github.com/nextcloud-releases/desktop | NKUJUXUJ3B |
| Element | Your Core's chat | packages.element.io | 7J4U792NQT |
| Tailscale | Your Core's network | pkgs.tailscale.com | W5364U7YZB |
An app is installed only if it's signed with its maker's Developer ID (the Team ID above) and Gatekeeper accepts it, which means Apple notarized it. The apps update themselves after that. Installing a .pkg (Nextcloud, Tailscale) asks for your Mac password.
Command-line tools are used as they are if they're already installed (e.g. with Homebrew). Otherwise they're downloaded into ~/.local/share/federated-connector, and each download is checked against the SHA-256 checksums its release publishes:
| Tool | For | From |
|---|---|---|
| restic | Backups | github.com/restic |
| rclone | Backups (reaching Nextcloud) | downloads.rclone.org |
| Node.js | Running the sandbox | nodejs.org (current LTS) |
| srt | The agent sandbox | npm (@anthropic-ai/sandbox-runtime) |
The agents are installed with their makers' own installers: claude.ai/install.sh, opencode.ai/install and hermes-agent.nousresearch.com/install.sh. Each installer is downloaded first and then run, rather than piped straight into bash.
Where things are
- Your answers:
~/Library/Application Support/Federated Connector/(cores/<domain>.conf,core.conffor the main Core,tailscale.conf,backup.conf,storage,ai-servers, and your ownsandbox/config) - App passwords and the backup passphrase: login keychain, services "Federated Connector" and "federated-connector-backup"
- Background jobs:
~/Library/LaunchAgents/computer.federated.connector.{backup,storage}.plist - Downloaded tools:
~/.local/share/federated-connector - The accounts: System Settings > Privacy & Security > Profiles (General > Device Management on some versions)
Adding an item
Each file in configure.d/ is one item. It sets TITLE and DESCRIPTION and defines is_configured and run_configure. It can also define is_installed, and the item is left out when that fails. Libraries are in configure.d/lib/:
json.sh: JSON through JavaScript for Automationkeychain.sh: secrets in the login keychainnextcloud.sh: app passwordsapps.sh: downloading and checking appstools.sh: downloading and checking command-line toolsprofile.sh: configuration profilesmdns.sh: finding things on the network with dns-sdsmb.sh: SMB sharesagents.sh: the agents' real commands and srt
system/ has what runs in the background (backup, storage-mount), and sandbox/ has the sandbox wrapper and its config.
Keep to bash 3.2: no mapfile, read -i, associative arrays or ${var,,}.
Testing
smoketest/run runs the scenarios in smoketest/, each in a fresh macOS VM, with Tart on an Apple silicon Mac. See smoketest/README.md.
Differences from CoreDesktop
- Mail, Calendar and Contacts come from a configuration profile, not GNOME Online Accounts. macOS asks you to approve the profile.
- Files sync through the Nextcloud app rather than a davfs2 mount.
- Backups and network storage run from launchd rather than systemd. Backups need Full Disk Access (see above), and network storage uses macOS' own SMB mounting and keychain rather than /etc/fstab.
- Network storage is SMB only; SFTP would need macFUSE.
- The sandbox uses Seatbelt rather than bubblewrap, so sandboxed agents reach everything, including local servers, through srt's proxy.
- Not ported: Cline Desktop (not packaged for macOS here), running Hermes' gateway in the sandbox, printers (AirPrint finds them), languages, Tally and the email watcher.