Files
wikideck/docs/night/IOS.md
T

5.7 KiB

iOS app and macOS VM (Night 1, mobile-ios, issue #9)

Status at a glance

  • macOS VM: QEMU/KVM on inspiron-3670, OSX-KVM style. Sequoia (15) recovery booted, disk erased (APFS volume machd), licence accepted, and "Reinstall macOS Sequoia" was downloading the full OS from Apple over inspiron's Wi-Fi (installer estimate ~2 h 50 min from 23:33). Per the coordinator, the VM is shut down cleanly before 01:30 with the disk kept. See "Progress at shutdown" below for exactly where it got to.
  • No Apple ID was created or used. Nothing signed in to Apple.
  • iOS Capacitor project: ios/ (Capacitor 7.6.x, Swift Package Manager, no CocoaPods), app id dev.eom.wikideck, URL scheme dev.eom.wikideck registered for the SSO redirect.
  • Build script: scripts/ios/build-sim.sh (run inside the VM once Xcode is installed). Not yet run: needs Xcode.

Where things are (inspiron-3670, outside git)

Path What
~/worker/jobs/macos/boot-macos.sh Starts the VM: 8 GB RAM, 4 vCPU, q35, OpenCore, VNC 127.0.0.1:5911, SSH fwd 127.0.0.1:10022
~/worker/jobs/macos/mac_hdd_ng.qcow2 80 GB macOS system disk (keep this)
~/worker/jobs/macos/BaseSystem.img Sequoia recovery (3,221,110,784 bytes), converted from macos-fetch's verified BaseSystem.dmg
~/worker/jobs/macos/OpenCore-osxkvm.qcow2 OpenCore bootloader from kholia/OSX-KVM
~/worker/jobs/macos/OVMF_CODE_4M.fd, OVMF_VARS.fd UEFI firmware and this VM's NVRAM
~/worker/jobs/macos/vnc.sh vncdotool wrapper (./vnc.sh capture x.png, ./vnc.sh type ...)
~/worker/jobs/macos/guest/provision.sh Runs inside macOS: Command Line Tools + Node 24 (no Apple ID)
~/worker/jobs/macos/CREDENTIALS.txt Local macOS user + password (mode 600, never in git), once the account exists

Start the VM again (resume)

On inspiron-3670:

cd ~/worker/jobs/macos
setsid ./boot-macos.sh > qemu.log 2>&1 < /dev/null &      # installer image still attached
# after macOS is fully installed you can detach it: NO_INSTALLER=1 setsid ./boot-macos.sh ...
  • In the OpenCore picker pick macOS Installer / machd (whichever is offered after the interrupted install; if only "macOS Base System" shows, the download restarts: pick it → Reinstall macOS Sequoia → disk machd).
  • Clean shutdown from outside: echo system_powerdown | socat - UNIX-CONNECT:$HOME/worker/jobs/macos/qemu-monitor.sock (or kill $(cat ~/worker/jobs/macos/qemu.pid) if the guest is hung).

See it (VNC through an SSH tunnel from tower-plus)

ssh -N -L 5911:127.0.0.1:5911 eric@inspiron-3670      # on tower-plus
# then open a VNC viewer on tower-plus at localhost:5911 (no VNC password; it is bound to localhost only)

SSH into macOS (after Remote Login is on): ssh -p 10022 <user>@127.0.0.1 on inspiron, or tunnel -L 10022:127.0.0.1:10022.

Note: the VNC keyboard via vncdotool drops Shift (everything types lowercase, | becomes \). A normal VNC viewer is fine.

Eric's checklist from here (~10 min of attention, plus download time)

  1. Finish the install: start the VM (above), open VNC, let the installer finish (several reboots, pick machd / macOS Installer in OpenCore each time if it doesn't auto-boot).
  2. Setup Assistant: country, skip Apple ID ("Set Up Later"), create a local admin user. Put the user and password in ~/worker/jobs/macos/CREDENTIALS.txt (chmod 600).
  3. Enable SSH: System Settings → General → Sharing → Remote Login: on.
  4. Prerequisites (no Apple ID): copy and run the guest script:
    scp -P 10022 ~/worker/jobs/macos/guest/provision.sh <user>@127.0.0.1:
    ssh -p 10022 <user>@127.0.0.1 ./provision.sh
    
  5. Sign in with your Apple ID and install Xcode (App Store, or developer.apple.com/download). Launch it once, accept the licence, install the iOS platform + a Simulator runtime when prompted.
  6. Build and run:
    ssh -p 10022 <user>@127.0.0.1
    git clone -b night/2026-11-16 https://gitea.eom.dev/claude/wikideck.git && cd wikideck
    scripts/ios/build-sim.sh            # optional arg: simulator name, default "iPhone 16"
    
    It runs npm ci, npm run build, npx cap sync ios, xcodebuild for the simulator (no signing), installs and launches dev.eom.wikideck, and saves a screenshot to ~/wikideck-ios-sim.png.

App notes

  • Scaffold (capacitor.config.ts, Capacitor deps in package.json) is owned by mobile-android (#8); ios/ builds on it. Capacitor 7 to match Android (Node 20 on inspiron).
  • Swift Package Manager, not CocoaPods: ios/App/CapApp-SPM/Package.swift is managed by npx cap sync; Xcode resolves capacitor-swift-pm itself. No Ruby/CocoaPods needed in the VM.
  • Node URL: build-time VITE_NODE_URL (defaults to the testnet), same as Android.
  • Origin check: mobile-android routes native requests through CapacitorHttp, which sends no Origin header, so server/testnet/http.ts needs no change. Without it, the iOS WebView origin would be capacitor://localhost.
  • SSO (#7): Info.plist registers the dev.eom.wikideck URL scheme; redirect dev.eom.wikideck:/oauth/callback returns to the app via @capacitor/app's appUrlOpen.

Progress at shutdown

(filled in before 01:25)

What's verified

  • BaseSystem.dmg sha256 matches macos-fetch's SHA256SUMS; converted BaseSystem.img is 3,221,110,784 bytes.
  • VM boots on inspiron (KVM, no host ignore_msrs change needed): OpenCore → Sequoia recovery → Terminal, Disk Utility.
  • Disk erase (APFS) and the installer download started.
  • npx cap add ios --packagemanager SPM (Capacitor 7.6.10) generates the project on Linux; bundle id dev.eom.wikideck.
  • Not verified: the macOS install finishing, Xcode, build-sim.sh, the app in the Simulator.