Files
connector-macos/README.md
T
davidandClaude Opus 5.5 8e2a886215 Mount SFTP folders in network storage, as CoreDesktop does
configure storage now finds machines that announce SFTP as well as SMB
servers, and takes sftp://[user@]host[:port][/path] addresses. Folders
are mounted with SSHFS on macFUSE, as you, with your SSH keys
(Bitwarden's SSH agent while it runs one), and never ask for a
password. storage-mount mounts them again at login and when the
network changes, as it does SMB shares; each line of the list now
records its mount point.

macFUSE and SSHFS are offered for download, checked against their
Team ID (3T5GSNBU6W, read from the packages' signatures). On macOS 26
and later macFUSE mounts through FSKit, whose extension you turn on
once in System Settings. Earlier macOS needs its kernel extension,
which this uses if it's running but doesn't set up.

smoketest: 85-sftp installs both and mounts a folder from the VM
itself over SSH, if macFUSE's extension can be turned on there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 08:55:55 -07:00

14 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 configure opens 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 core again 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 core also 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.
  • Tailscale: joins this Mac to your Core's Tailscale network through headscale.example.com. To leave it, run configure tailscale again.

  • 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 configure shows 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. configure opens 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. Run configure backup again 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.
  • Network storage: shared folders from other machines on your network, mounted in /Volumes and shown in Finder's sidebar. It finds SMB servers (Windows PCs, NAS boxes, Macs with File Sharing on) and machines that announce SFTP (Macs with Remote Login on, many Linux machines), or you enter an address (smb://nas.local/files, sftp://me@server.local/srv/data). A launchd job mounts them again at login and when the network changes, skipping servers it can't reach. "Remove one" unmounts it and takes it off the list.

    • SMB is built into macOS. Leave out the share to choose from a list. The sign-in window can keep the password in your keychain, and mounting again at login needs it there.
    • SFTP uses macFUSE and SSHFS, which configure storage offers to install. It needs macOS 26 or later, where macFUSE runs in user space through FSKit; you turn on its file system extension once, in System Settings > General > Login Items & Extensions. On earlier macOS, macFUSE needs its kernel extension, which on Apple silicon means starting up in Recovery and lowering security. This doesn't do that, but it uses the kernel extension if you've set it up yourself. As in CoreDesktop, an SFTP folder is mounted as you with your SSH keys (Bitwarden's SSH agent while it's running, otherwise macOS' agent and ~/.ssh) and never asks for a password, so the server has to accept one of your keys.
  • 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 opencode and configure hermes sign 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
macFUSE SFTP folders github.com/macfuse/macfuse 3T5GSNBU6W
SSHFS SFTP folders github.com/libfuse/sshfs (linked from macfuse.github.io) 3T5GSNBU6W

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.conf for the main Core, tailscale.conf, backup.conf, storage, ai-servers, and your own sandbox/ 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 Automation
  • keychain.sh: secrets in the login keychain
  • nextcloud.sh: app passwords
  • apps.sh: downloading and checking apps
  • tools.sh: downloading and checking command-line tools
  • profile.sh: configuration profiles
  • mdns.sh: finding things on the network with dns-sd
  • smb.sh: SMB shares
  • agents.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.
  • SFTP folders need macFUSE and SSHFS, and macOS 26 or later (or macFUSE's kernel extension), where CoreDesktop uses sshfs on FUSE, built into Linux.
  • 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.