Skip to content

Run the emulated Mac from the packaged exporter, by starting itself - #294

Merged
parawanderer merged 5 commits into
mainfrom
feat/frozen-emulated-mac
Nov 20, 2026
Merged

parawanderer merged 5 commits into
mainfrom
feat/frozen-emulated-mac

Conversation

@parawanderer

Copy link
Copy Markdown
Owner

Stacked on #292; its commits drop out of this diff once it merges.

#292 runs the emulated Mac's engine as python -m machoadi.mac_anisette, which a PyInstaller build cannot do, so the packaged window refused to sign in. The frozen exporter now runs itself as the engine.

  • wizard.py checks sys.argv[1] == --run-emulated-mac before anything else and calls macadi.run_engine_here. Separate process, same executable, so Windows' Control Flow Guard setting carries over.
  • macadi.load_engine imports machoadi's modules leaves first and registers each under its bare name. They import one another as from harness import ... after a sys.path insert that resolves to nothing inside a PyInstaller archive.
  • Engine output goes to two files the parent names; a windowed Windows build may have no standard streams.
  • --collect-submodules machoadi in all three release invocations, the Windows build check, and OpenTagViewer.spec.
  • --self-test fails if the engine is not bundled. exporter-build-check.yml runs the frozen engine's info against Apple's real library (no request to Apple beyond the library download).

Verified: local macOS PyInstaller build: --self-test passes; through the frozen binary the engine runs info, provision and headers (TLS verified, Mac OS X client info, 0PENTAGX serial); a full sign-in and export from the window. 704 exporter tests; the bare-name aliasing test fails with the registration removed. Not verified: the Linux and Intel macOS binaries, which are built only at release.

Drafted by Claude Code

🤖 Generated with Claude Code

parawanderer and others added 5 commits November 20, 2026 17:35
…s the app

parawanderer/FindMy.py#9 (merged as 37d5ca0b) reads Grand Slam's hsc 409
with no au as a second factor, so an account Apple wants a code for is asked
for one instead of failing at the mobileme step (#248). The exporter runs the
same library, so it gets the same fix. Moved in all four places (AGENTS.md
rule 14); uv.lock by `uv lock`.

Co-Authored-By: Rob Lazzurs <rob@lazzurs.ie>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…reADI

Since 2026-10-12 Apple serves the Android ADI machine that `anisette`
provisions differently from a Mac (#248), and the exporter's iCloud route
signs in as exactly that machine (#288). This makes the default an emulated
Mac instead: Apple's x86_64 CoreADI under Unicorn, through sacca97's machoadi
engine from os-findmy-e.

- The engine is GPL-2.0 and runs as `python -m machoadi.mac_anisette` in its
  own process, never imported. It comes from parawanderer/os-findmy-e, which
  spells the OS "Mac OS X" (#289), verifies TLS against FindMy.py's pinned
  Apple root rather than CERT_NONE, takes a serial, and installs with pip.
- Apple's library is fetched from Apple: 3.5 MB of the iTunes 12.8.3
  installer in one range request, checked against two pinned hashes. A port
  of the app's MacCoreAdiFetcher; nothing for the user to supply, on any OS.
- The machine is provisioned once, under this install's 0PENTAGX serial, and
  kept beside device-identity.json. The account signs in with the ids it was
  provisioned with. An install that was the Android machine gains one
  device-list entry, once, and is told so.
- CloudKit is given the machine's host UUID, since it parses the device id as
  a UUID and a Mac's is not one (as #274's _forCloudKit).
- --anisette-url is unchanged; --anisette-libs now explicitly selects the
  Android ADI. A PyInstaller build refuses with a message for now: it has no
  interpreter to run the engine with.

Not yet verified: a real sign-in through it.

Co-Authored-By: sacca97 <tommaso.sacchetti@gmail.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A PyInstaller build has no interpreter for `python -m machoadi...`, so the
window could not sign in at all. It now runs itself with --run-emulated-mac,
which wizard.py checks before anything else and hands to
macadi.run_engine_here. Still its own process, as the engine needs and as
keeps the GPL code apart, and on Windows the same executable, so it inherits
the Control Flow Guard setting Unicorn needs.

- machoadi's modules import one another by bare name after putting their
  directory on sys.path; a frozen bundle has no such directory. load_engine
  imports them leaves first as machoadi.<name> and registers each under its
  bare name, so every one of those imports finds the loaded module.
- The answer comes back through two files the parent names, since a windowed
  Windows build may have no standard streams.
- --collect-submodules machoadi in every PyInstaller invocation and the
  spec: nothing imports it at build time, so analysis would drop it.
- --self-test checks the engine is bundled. The Windows build check runs the
  frozen engine's `info` against Apple's real library.

Verified on a local macOS build: self-test passes; through the frozen binary
the engine reports, provisions with Apple and returns headers with the
"Mac OS X" identity and this install's serial. Not verified: a sign-in from
the window, or the Windows and Linux binaries beyond CI.

Co-Authored-By: sacca97 <tommaso.sacchetti@gmail.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@parawanderer
parawanderer merged commit 641104f into main Nov 20, 2026
10 checks passed
@parawanderer
parawanderer deleted the feat/frozen-emulated-mac branch November 20, 2026 18:44

This branch was previously deployed

1 inactive deployment
Android Build — 64a2b46a Deployed Nov 20, 2026 by parawanderer via Instrumented tests (emulator) #365
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