DV.OS 8.X/BLOG/POST 10 OF 11/WHAT WE DO
Digital Vision
~/blog/setting-up-a-spare-mac-in-one-command.md
Cover for The spare, in one command: the working day drawn as a line, broken for the hours the business was dark, with a coral marker on this post's moment

The day the laptop died · Post 10 of 11 · Coda

The spare, in one command

In shortThe rule: prepare the spare before you need it, write down which steps only a human can do, and don't call it ready until you've watched it work on a machine that started empty.

Rule eight said the spare machine has to be genuinely ready, not theoretically ready. I wrote that at about three in the afternoon. By the evening I had to prove it, because a replacement was on its way and I was not going to spend another day wrangling an environment.

So this post is the coda: what you can prepare before a machine exists, what you can't, and the one decision that happens in the first two minutes and can't be taken back.

Everything that can be done before the hardware arrives

It turns out to be most of it.

A list of everything you own. This is the one that bit. My setup script had a manifest of repositories to clone, and that manifest had been built, at some point, from whatever happened to be sitting on one machine. It listed 71. When I asked GitHub directly, the account holds 132. Sixty-one missing — including client work made in the last few weeks, on the laptop that had just died. A fresh Mac rebuilt from that list would have looked complete and been missing a third of my work. The new manifest is generated from the account itself, which is the only source that can't quietly go stale.

The secrets. This is the one that would have cost a full day. GitHub deliberately never carries .env files, which is correct and also means a freshly cloned repository builds nothing. Thirty-five of the copies on this machine carry one, and the real number across the account can only be higher. They exist in exactly one place — the documents folder that syncs through iCloud — so there's now a script that matches each repository to its secret file and puts it back, printing the date of each one so a key rotated since the snapshot is visible rather than silently broken.

The machine itself. One script: command line tools, Homebrew, git, node, the assistant, an SSH key registered with GitHub, every repository cloned, the assistant's rules and memory wired up, secrets restored, backup installed. It reports before it acts, never overwrites anything, and finishes by printing a numbered list of what still needs a person.

The setup, in order. The dark steps run unattended. The four coral ones are the gates a script is not allowed through — and knowing which they are in advance is most of the value.

The two minutes you can't undo

The single irreversible decision happens in Setup Assistant, before any of this runs: the account's short username.

Use the same one as the dead machine. Every absolute path ever written on that laptop — in notes, in scripts, in the assistant's own memory files, in documentation — begins /Users/<name>. Match it and all of them resolve. Don't, and you spend months finding references that quietly point nowhere. Changing a macOS short username afterwards means moving the home folder by hand, and it breaks things in ways that don't announce themselves.

It is the cheapest decision in the whole process and the only one with no undo.

The four things a script can't do

Everything else that afternoon was automatable. These four are not, and they're the same four every time:

  1. Clicking an installer. The command line tools dialog needs a human.
  2. Typing a password. Homebrew needs one; a script that wants your password is a script you shouldn't run.
  3. Signing in. GitHub authentication is a browser and a human, by design.
  4. Granting a permission. Disk access for a background job, in a settings pane, using a keyboard shortcut to reach a hidden folder.

That's roughly twenty minutes of attention. The hour of cloning either side of it is unattended. Knowing that split in advance is the difference between a setup you can start before dinner and one that eats an evening.

And the honest bit

I haven't run it.

The script exists, it's been checked against this machine and correctly reported what was missing, and it's staged where a new Mac will find it before it has any GitHub access at all. But it has never been run end to end on a bare machine, because there hasn't been one to run it on.

Which means, by my own rule four, I don't have a verified setup. I have a script. Proof of restore, not proof of run — and I'm not going to tell you the thing works when what I've actually done is write it and test the parts I could.

The real test is the next machine. If it goes as designed, the whole of this series ends with a dead machine reduced to twenty minutes of clicking. If it doesn't, that's the next post, and it'll be more useful than this one.

The rule: prepare the spare before you need it, write down which steps only a human can do, and don't call it ready until you've watched it work on a machine that started empty.

Next, and last: what I learned about myself from all this — and what the assistant learned, which turns out to be a different and slightly stranger question.