# Restore on new Mac mini (user: dd02mini)

## Before you start
- Create macOS admin user **exactly** `dd02mini`
- Keep SSD mounted: `MJL SSD`
- Pack root: `/Volumes/MJL SSD/dd02mini-migrate-2026-08-18/`
- **Only one** personal archive should exist:

```text
personal-restore/MacMiniBackup_dd02minis-Mac-mini_dd02mini_2026-08-18.7z
```

## Preferred path (fail-closed script)

```bash
# On NEW Mac as user dd02mini
brew install p7zip
export PATH="/opt/homebrew/bin:$PATH"
bash "/Volumes/MJL SSD/dd02mini-migrate-2026-08-18/personal-restore/restore-dd02mini-from-pack.sh"
```

What the script does:
1. Fails unless `id -un` is `dd02mini` and `$HOME` is `/Users/dd02mini`
2. Verifies sha256 + `7za t`
3. Extracts to `/tmp` stage (not straight to `/` as root)
4. `rsync` home as you (correct ownership)
5. `sudo rsync` Applications / Homebrew / system Application Support
6. `chown -R dd02mini:staff $HOME`

**Do not** run `sudo 7za x … -o/` as the primary method (root-owned home risk; crude merge).

**Do not** use `MacMiniBackup_*.7z` globs with 7za when multiple archives could exist — a second path becomes an include filter and can restore **0 files with exit 0**.

## Manual verify (optional)

```bash
cd "/Volumes/MJL SSD/dd02mini-migrate-2026-08-18/personal-restore"
ARCH="MacMiniBackup_dd02minis-Mac-mini_dd02mini_2026-08-18.7z"
shasum -a 256 -c "$ARCH.sha256"
7za t "$ARCH" | tail -20
```

Known good: sha256 `50fb2e51239c4c94b3c4613b42effe248cf55739420d3772c68f76406c584c4f` · bytes `5180741753`

## After script: stack bring-up

```bash
export PATH="$HOME/.local/bin:/opt/homebrew/bin:$PATH"
# Restart Mac once after file promote, then:
# Unlock 1Password
open -a OrbStack || true
sleep 8
cd ~/openbrain && docker compose up -d
# If DB empty, import newest dump:
#   gunzip -c ~/backups/openbrain/openbrain-*.sql.gz | docker exec -i openbrain-postgres psql -U openbrain openbrain
hermes doctor
# If gateway not up:
#   launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/ai.hermes.gateway.plist
ollama pull nomic-embed-text
aios-backup-guard
cd ~/airbnb-adu-command-center-mvp
test -f package.json && (pnpm i || npm i) || true
python3 scripts/verify_all.py
```

## Acceptance (keep source Mini until green)
- [ ] restore script completed without ERROR
- [ ] home files owned by dd02mini (not root)
- [ ] hermes health / gateway OK
- [ ] OpenBrain healthy **with expected data** (not empty DB mistaken for success)
- [ ] airbnb `verify_all.py` pass
- [ ] aios-backup-guard green
- [ ] WhatsApp only if needed (session present; may re-link)

## Intentional gaps (not archive corruption)
| Gap | Fix |
| --- | --- |
| OrbStack VM / `~/.orbstack` | Open OrbStack; compose up |
| `~/.ollama` weights | `ollama pull` |
| Some TCC Library items | re-login / FDA |
| Cloud OAuth | re-auth |
| Unencrypted private .7z | physical custody of SSD; never upload to install02 |

## Public lane
Deploy only `public-installer-site/` to install02 — never `personal-restore/`.
