Skip to content

v1.4.0 — fix false 'Error' on fresh-Mac install (CLT before git clone)#2

Open
SashaMIT wants to merge 6 commits into
mainfrom
fix/macos-clt-before-clone
Open

v1.4.0 — fix false 'Error' on fresh-Mac install (CLT before git clone)#2
SashaMIT wants to merge 6 commits into
mainfrom
fix/macos-clt-before-clone

Conversation

@SashaMIT

Copy link
Copy Markdown
Contributor

v1.4.0 — launcher

Reconciles main (stale at v1.2.7) onto the shipped v1.2.9 line and adds the macOS first-run fix.

The fix

On a clean Mac, installPC2's first step (git clone) invoked Apple's git shim, which popped the "install developer tools?" dialog and exited non-zero → the install loop rejected → UI flipped to "Error", even though the tools were installing fine in the background (a second Power-click then worked). Anders hit exactly this on v1.2.9.

v1.2.9 already had ensureXcodeCommandLineTools() but only called it inside setupNetworking() — which runs after the clone, i.e. too late.

Change: hoist the existing (idempotent) ensureXcodeCommandLineTools(onProgress) to the top of installPC2, before the bundled-node download and git clone. Fresh Macs now see "Installing Xcode Command Line Tools…" and the install continues seamlessly; only a genuine 20-min timeout errors. No duplication; no-op on Windows/Linux and on machines that already have CLT.

Also bumps the launcher version to 1.4.0 to align with the ElastOS 1.4.0 release (the launcher's update check reads pc2's version, not its own, so this is cosmetic/release-naming only).

Base

Branched from the v1.2.9 tag (the actual shipped code), not stale main.

Verify

tsc clean. Recommend a fresh-Mac (or CLT-removed VM) smoke test of the "Installing developer tools…" path before/after publish.

Made with Cursor

SashaMIT and others added 6 commits May 28, 2026 17:11
The launcher's CONTRIBUTING.md "Install Parity Rule" requires that
setupNetworking() install the same toolchain as pc2.net's terminal
install scripts (start-local.sh, install-arm.sh). FFmpeg was added
to start-local.sh in the dDRM media-encoding lineage but never
propagated to the launcher, breaking the rule and leaving every
Mac user without Homebrew + ffmpeg one click away from
"FFmpeg not found" when they tried to mint a video.

This commit closes the parity gap:

- FFmpeg block: `brew install ffmpeg` on macOS / `apt-get install -y
  ffmpeg` on Linux (via sudoExec, same osascript / pkexec pattern as
  the existing networking blocks). Reports AV1 vs H.264-only at end.
  Non-fatal — wrapped in try/catch + warning log so launcher still
  brings PC2 up if ffmpeg install fails.

- cmake block: same pattern. cmake is needed by node-datachannel's
  source-build fallback when no prebuild matches the user's Node ABI
  — prebuilds usually cover us but when they don't, the install dies
  with "OMG CMake executable is missing" and the user is stuck. The
  launcher already detects this and logs a "brew install cmake" hint
  (line 1345); now it just does it automatically, matching start-local.sh.

- CONTRIBUTING.md "Current Tools Installed by All Paths" table now
  lists FFmpeg + cmake so the Install Parity Rule cannot drift again
  for these two without a documentation diff.

- README.md "What Gets Installed" updated for the same reason —
  the user-visible promise on the download page now matches reality.

Build path verified: `npm ci && npx tsc --noEmit` both clean.

Pairs with pc2-node release/2026-05-28-ddrm-hardening which adds a
startup ffmpeg probe so a missing binary is fail-loud in the launcher's
log viewer instead of being discovered mid-mint.

Recommended release sequence: pc2.net smoke-test green → launcher
v1.2.8 tag (triggers Apple notarisation, ~75 min) → virgin-Mac
rehearsal of new .dmg → only then merge pc2-node to main.

Co-authored-by: Cursor <cursoragent@cursor.com>
v1.2.8 ships the install-parity fix (ffmpeg + cmake) on top of v1.2.7's
heartbeat-based pc2-node status tracking. With this release, fresh macOS
and Linux installs via the launcher transparently install ffmpeg (for
dDRM video minting) and cmake (for native module fallback builds),
restoring parity with start-local.sh / install-arm.sh per CONTRIBUTING.md
Install Parity Rule.

Coupled to pc2.net release/2026-05-28-ddrm-hardening (RPC pool
unification + PSSH-baked-RPC override for legacy dDRM video assets).

Co-authored-by: Cursor <cursoragent@cursor.com>
Fresh-Mac users on v1.2.8 hit "FFmpeg not found", "wireguard-tools not
installed", and "cmake missing" silently because pc2Manager.ts assumed
Homebrew was already present. On a brand-new Mac, no `brew install X`
command actually ran — the try/catch wrappers swallowed every failure
with a warning log nobody reads.

v1.2.9 fixes this at the architectural level instead of bundling 200MB
of static binaries:

  - ensureXcodeCommandLineTools() triggers Apple's native CLT installer
    dialog (no password, no terminal — just an Apple system "Install"
    button) and polls xcode-select -p for completion.
  - elevatedSetup() consolidates ALL macOS root operations into a
    single osascript-driven password prompt at the START of
    setupNetworking. It:
      * pre-chowns /opt/homebrew (Apple Silicon) or /usr/local (Intel)
        to the regular user so future `brew install X` runs without sudo
      * pre-chowns /usr/local/bin so the sing-box manual-download
        fallback can `cp` into it without sudo
      * installs Homebrew via NONINTERACTIVE=1 (Homebrew's officially
        supported CI/CD mode) dropped to the regular user via sudo -u,
        avoiding Homebrew's "refuses to run as root" check
      * writes /etc/sudoers.d/elastos pre-granting NOPASSWD for
        wg-quick + awg-quick at BOTH possible brew paths, so the rules
        apply no matter which prefix gets used
      * validates the sudoers file with `visudo -c` before trusting it
        (deletes the file and aborts if syntax invalid, never leaves
        the system in a broken state)
      * cleans up legacy /etc/sudoers.d/{wireguard,amneziawg} from
        launcher <=1.2.8

After elevatedSetup() runs once, the previous 5 scattered sudoExec
calls (WireGuard sudoers, AmneziaWG cp + sudoers, awg-quick sed,
sing-box cp) become non-sudo operations because their destinations
are now user-owned. Net result on macOS:

  v1.2.8: 6 password prompts scattered throughout install (~10-30 min
          install with prompts interrupting at random)
  v1.2.9: 1 Apple CLT dialog (if needed) + 1 password prompt upfront,
          then ~10 min unattended background install. Returning users
          (brew + sudoers already set up) see 0 prompts.

Linux flow is unchanged — apt-get's per-call sudo prompt model is
already adequate there.

Sudoers template validated with `visudo -c` (parsed OK).
TypeScript compile + lint clean.

Updates CONTRIBUTING.md install-parity table and README.md to document
the new fresh-Mac UX.

Co-authored-by: Cursor <cursoragent@cursor.com>
On a clean Mac, installPC2's first step (`git clone`) invokes Apple's `git`
shim, which pops the "install developer tools?" dialog AND exits non-zero.
The install loop rejected on that exit and the UI flipped to "Error" — even
though the tools were downloading fine in the background and a second click
of Power then succeeded. (Anders hit exactly this on the shipped v1.2.9.)

v1.2.9 already had ensureXcodeCommandLineTools(), but only called it inside
setupNetworking() — which runs AFTER the git-clone step loop, i.e. too late.

Fix: hoist the existing (idempotent) ensureXcodeCommandLineTools(onProgress)
call to the top of installPC2, before the bundled-node download and git
clone. Now a fresh Mac sees "Installing Xcode Command Line Tools…" progress
and the install continues seamlessly once they land; only a genuine timeout
errors. No duplication — reuses the existing function; the setupNetworking
call remains as a fast no-op. No-op on Windows/Linux.

Co-authored-by: Cursor <cursoragent@cursor.com>
…ase)

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant