Publish the Mac app
Teammates download Agents for Mac from your server. The server gives out one signed zip, made for that server, and only to people on the team, through the people socket. Until you publish a zip, the download page tells an admin how to publish one and tells a member to ask an admin. This page builds the zip and points the server at it.
You need a Mac with Apple silicon, a Developer ID Application certificate in its login keychain, an Apple account that can notarize, and an Agents server at https, such as https://gomoe.dev.
Store the notarization login
Section titled “Store the notarization login”Apple’s notarization needs credentials in the Mac’s keychain, under a profile name. Store them once. The release script never reads them, and notarytool reads them when it submits.
-
Make an app-specific password at
account.apple.com, under Sign-In and Security, then App-Specific Passwords. -
Store the credentials under the profile name
agents-notary.Terminal window xcrun notarytool store-credentials "agents-notary" --apple-id <your Apple ID> --team-id <your team id>
xcrun asks for the app-specific password. Another profile name works if you pass it with --profile.
Release the app
Section titled “Release the app”Run the release script from the checkout, on the Mac that holds the certificate. Name the server the app is made for, and, if you want, the folder the app keeps in each person’s home. The script’s default --identity is not yours, so pass your own certificate’s full name.
node daemon/mac/release.ts --server https://<your server> --home .agents-<name> --identity "Developer ID Application: <Your Name> (<TEAMID>)" --publishThe script does these things in order.
- Checks that the server is at https and answers as Agents, that the identity is in the keychain, and that the notarytool profile works. The app carries that server and the home folder
--homenames, such as~/.agents-gomoefor the gomoe.dev release’s--home .agents-gomoe, so it opens there on each Mac with nothing to set. With no--homethe folder is named from the server’s whole address, such as~/.agents-team.devforhttps://team.dev, so two servers never share one. A build for a server that signs people in itself has no Tailscale step, and one for a server on a tailnet keeps it. - Builds the app from the working tree. It says which commit that is, and warns when the tree has uncommitted changes.
- Signs everything in the app with the identity and the hardened runtime.
- Sends the app to Apple, and waits up to 30 minutes for an answer.
- Staples Apple’s ticket to the app, and checks that Gatekeeper accepts it.
- Zips the app, and prints the zip’s size and sha256.
- With
--publish, copies the zip toAgents-mac.zipin the--outfolder, and then writes which build it is beside it, inAgents-mac.zip.json, which the server reads to name the build it gives out.
These options change that.
--dry-runchecks everything it can, prints the server and home, and builds and sends nothing.--profile <name>names another notarytool profile.--out <folder>sets where the app and zip are made. The default is.scratch/mac-releasein the checkout.
With no stored profile, the script builds and signs, zips the signed app, and prints the command that stores a profile. A Mac that opens an app with no ticket sees a Gatekeeper warning. For that reason --publish refuses to run without notarization, and nothing is built or published.
The script exits with 0 when done, 1 on a failure, 2 on a usage error, such as no --server, and 3 when it refused and changed nothing. It refuses on a machine that is not a Mac.
Point the server at the zip
Section titled “Point the server at the zip”On the AWS server, run the command the script printed, node ops/aws-deploy/mac-app.ts <the path to Agents-mac.zip>. It copies the zip and its build file to the server, and each deploy copies them again. It refuses, and uploads nothing, a zip made for another server than the stack’s own, or one whose sha256 or size is not what its build file says. Before it uploads, it writes the release notes into the build file: every pull request merged since the build the server gives out now, then that build’s own notes back 30 days. Run it from a checkout with the whole history, since it reads the notes from git. On another server, which gets no notes:
-
Copy
Agents-mac.zipandAgents-mac.zip.jsonto the server, and add the zip’s path to.env. It must be an absolute path. The API stops at start with a message when the path is relative.Terminal window AGENTS_MAC_APP=<the path to Agents-mac.zip> -
Restart the API once.
The server reads the file on each download. A later release replaces the file, and the server needs no restart.
Each Mac running Agents asks the server for a newer build every 15 minutes, downloads it, and checks your signature on it and that it is made for the same server and home. Its menu bar menu then offers Restart to Update…, and the update installs when the person restarts from it or next quits Agents. The sign-in, the Mac and its connected folders stay as they were. A Mac whose Agents sits in a folder the person can’t write downloads nothing and says to download the zip by hand.
What people see
Section titled “What people see”The server answers one of three ways.
AGENTS_MAC_APPis not set. The page tells an admin to publish withnode daemon/mac/release.ts --publishand set the variable.AGENTS_MAC_APPnames a missing or empty file. The page tells an admin to publish the app.- The file is there. The page offers Download Agents for Mac, with the file’s size and when it was made. The zip downloads as
Agents.zip.
A person opens the page at /#/download on your server, from the person menu’s Agents for Mac, or from the link on People under Agents for Mac. After an invite, the app shows the link to send with it. The page says the app needs a Mac with Apple silicon and macOS 13 or later.
What the app does on first open
Section titled “What the app does on first open”The first open walks through these steps and shows only what is missing.
- Tailscale, only for a server on a tailnet. The app checks that Tailscale is installed, running and signed in.
- The server, which the app was made for. A person can type another team’s server’s address, and the app keeps it in its home.
- The team. On a server on the web the person signs in through the browser first. A person with an open invite joins. A person with none waits for an admin.
- This Mac. The app adds the Mac with a token it made, and sends the server only the token’s hash. Its daemon reaches the server through the server’s door for Macs, such as
https://gomoe.dev/machine. - The daemon. The app starts the daemon and keeps it running.
The environment comes before what the app was made for. AGENTS_SERVER names another server and AGENTS_HOME another home folder. A Mac that runs Tailscale in userspace mode sets AGENTS_PROXY to the address of Tailscale’s local proxy.
Run the app from the checkout
Section titled “Run the app from the checkout”npm run desktop opens a window onto the server from the checkout, with no daemon. It needs AGENTS_SERVER and AGENTS_HOME, and stops with a message when they are not set.