Skip to content

Play your own Switch games on iPhone/iPad — one-click macOS app, no terminal. | 把 Switch 游戏装进 iPhone:图形界面一键构建,不用命令行。Bring your own game.

Add tools/try-local: build and open the Mac app from the checkout without CI

v0lumehi45fe0b649420
diff --git a/AGENTS.md b/AGENTS.md
index 1f84cb59..edf3cd75 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -3,12 +3,12 @@
This is the fork's guide. The engine has its own, upstream's: [engine/AGENTS.md](engine/AGENTS.md) (after `python3 tools/engine.py sync`, or [seedds/nxnative's AGENTS.md](https://github.com/seedds/nxnative/blob/main/AGENTS.md)). Read this file first, the engine's for any work in `engine/`.
- **Install the git hooks first.** In every clone and worktree, before any other work, run `git config core.hooksPath .githooks`. `python3 tools/engine.py sync`, `check` and `export` and the Claude Code session start do it when it is unset. Keep the hooks installed. Never use `--no-verify` on `git commit` or `git push`. Never push to `main` directly, every change goes through a PR, patches included. The pre-push hook rejects a push to `main` for every tool, and the "Main rule" ruleset on GitHub rejects it for everyone, with no bypass.
-- **Layout.** NX2Apple is the launcher and the glue around [seedds/nxnative](https://github.com/seedds/nxnative), which runs Nintendo Switch games natively on Apple platforms. This repository commits: `frontend/` (the Mac launcher, SwiftUI), `frontend-qt/` (the Qt front end), `frontend-ios/` (the iPhone shell), `tools/` (`engine.py`, `patches.py`, `release_manifest.py` and their tests, `try-pr`), `patches/` (the series), `.upstream-ref` (the nxnative commit we build on), `.github/` (CI, forms, triage), the player and developer pages (`README*.md`, `GAMES*.md`, `BUILDING*.md`, `CONTRIBUTING*.md`, `CHANGELOG*.md`, `RELEASING.md`). The engine (`dm/`, `scripts/`, `docs/`, `ref/`) is **not** here: it is nxnative at the pin plus `patches/`, built into `engine/` by `python3 tools/engine.py sync`. `engine/` is a real git repository that this one ignores. A root `.ignore` keeps it visible to ripgrep.
+- **Layout.** NX2Apple is the launcher and the glue around [seedds/nxnative](https://github.com/seedds/nxnative), which runs Nintendo Switch games natively on Apple platforms. This repository commits: `frontend/` (the Mac launcher, SwiftUI), `frontend-qt/` (the Qt front end), `frontend-ios/` (the iPhone shell), `tools/` (`engine.py`, `patches.py`, `release_manifest.py` and their tests, `try-pr`, `try-local`), `patches/` (the series), `.upstream-ref` (the nxnative commit we build on), `.github/` (CI, forms, triage), the player and developer pages (`README*.md`, `GAMES*.md`, `BUILDING*.md`, `CONTRIBUTING*.md`, `CHANGELOG*.md`, `RELEASING.md`). The engine (`dm/`, `scripts/`, `docs/`, `ref/`) is **not** here: it is nxnative at the pin plus `patches/`, built into `engine/` by `python3 tools/engine.py sync`. `engine/` is a real git repository that this one ignores. A root `.ignore` keeps it visible to ripgrep.
- **Commit with your own git identity, never upstream's.** Use the identity configured for your clone, or your own name and email. `engine/AGENTS.md` ends with a `git -c user.name=seedds -c user.email=…` line because it is written for seedds/nxnative, where seedds is the maintainer. Do not copy it here: it makes fork commits, and the `From:` line of patches made with `tools/engine.py export`, show upstream's author. Commit only when asked.
- **Here first, upstream in parallel.** A fix to the engine, to a game profile or to upstream's docs may land here first, as a patch. The same change goes to seedds/nxnative as a pull request in parallel, from a branch off their main (`git -C engine fetch seedds`, `engine/` has the remote). If you cannot open that pull request, a maintainer sends it. A patch here is a bridge until upstream has it, and the next bump drops it once the change is in. [patches/README.md](patches/README.md#here-first-upstream-in-parallel) has the rule and the `Upstream-Status` values.
- **How a commit in `engine/` becomes a patch.** Work in `engine/` (it holds upstream's tree with our patches as commits on top): change, test, commit with a message that says what and why. `python3 tools/engine.py export` turns the commits made since the last sync into `patches/NNNN-*.patch` with the header `Upstream-Status`, `Reason` and `Issue` (fill them in, `--status`, `--reason` and `--issue` set them) and adds them to `patches/series`. `python3 tools/engine.py check` must pass (headers, no patch on the shader chain, the series applies to the pin). The same commit goes to seedds/nxnative as a pull request in parallel. The patch says `pending` until that pull request is open, then `forwarded seedds/nxnative#<n>`. Commit `patches/` in a PR here. `sync` never throws away work in `engine/`: it stops and names `export`.
- **Never add engine files to this repository.** Files under `dm/`, `scripts/`, `docs/` and `ref/` at the root are ignored by `.gitignore`, and the `pr-scope` check fails a PR that adds them. A direct edit of engine files is lost on the next sync.
-- **Issues and pull requests.** Follow [CONTRIBUTING.md](CONTRIBUTING.md), section "For AI agents and other tools", and the forms and the PR template in `.github/`. Fix or feature: every fix goes through a PR and merges when CI is green, unless a maintainer's "changes requested" review is unanswered (a plain review comment does not block, and @LNPANDY decides only when the maintainers disagree), a maintainer's own feature after 48 hours (a feature from outside never merges by waiting, a maintainer has to agree, try the app and review the code), a patch is renumbered by whoever merges it, releases and version bumps are the owner's ([RELEASING.md](RELEASING.md): a release candidate tag first, the final tag on its commit). `tools/try-pr <PR number|main|tag>` opens the app CI built. Never attach or commit keys, game files or data extracted from a game.
+- **Issues and pull requests.** Follow [CONTRIBUTING.md](CONTRIBUTING.md), section "For AI agents and other tools", and the forms and the PR template in `.github/`. Fix or feature: every fix goes through a PR and merges when CI is green, unless a maintainer's "changes requested" review is unanswered (a plain review comment does not block, and @LNPANDY decides only when the maintainers disagree), a maintainer's own feature after 48 hours (a feature from outside never merges by waiting, a maintainer has to agree, try the app and review the code), a patch is renumbered by whoever merges it, releases and version bumps are the owner's ([RELEASING.md](RELEASING.md): a release candidate tag first, the final tag on its commit). `tools/try-pr <PR number|main|tag>` opens the app CI built. `tools/try-local` builds the app from your checkout without CI and opens it (engine tree, launcher, bundled tools, ad-hoc signed, version `<appVersion>-local`). The first run builds the bundled tools, which it caches (minutes), a later one takes about the time of `swift build`. It is not a release and cannot sign: an rc tag still needs CI and the owner's key. Never attach or commit keys, game files or data extracted from a game.
- **Merging with admin rights.** An admin merge never goes over a red check. That holds even when @LNPANDY overrides an objection. If a re-review is slow, the other maintainer pings the reviewer and does not merge with admin rights.
- **Checks.** `cd frontend && swift build && swift test` for the Mac launcher (its tests read `engine/`, so sync first), `python3 -m unittest discover -s frontend-qt/tests` for the Qt front end (and `python3 frontend-qt/gen_localization.py` leaves `frontend-qt/nspb_qt/localization.py` unchanged), `python3 -m unittest discover tools/tests` for the tools. The engine's own tests run in `engine/` as `tests.yml` does. The pre-commit hook runs `python3 tools/engine.py check` when `patches/` or `.upstream-ref` is staged. The pre-push hook runs the checks above for the files the push changes, `tools/githooks.py` has the list. Fix the failure, do not bypass the hook.
- **Language and text.** Everything is in English except the Chinese pages (`*.zh-CN.md`) and the launcher's strings. No semicolons in UI strings, READMEs and docs.
diff --git a/RELEASING.md b/RELEASING.md
index 04a1d9fd..6293d462 100644
--- a/RELEASING.md
+++ b/RELEASING.md
@@ -29,7 +29,7 @@ A candidate is built once. A second run of the same tag fails once the app is up
The candidate's signed `latest.json` names the `engine_id` the release carries. The whole-app test checks that the app's first start, with its online engine check, lands on exactly that engine tree. The engine that `engine-experimental` serves that day does not count.
-- In a checkout, `tools/try-pr v0.7.6-rc1` downloads the app, checks its SHA-256 and its bundled `engine_id` against the candidate's `latest.json`, and prints the `engine_id`. It opens the app with launch arguments that make it build with its bundled engine: the stable channel, that `engine_id`, and no automatic engine or app update. The arguments last for that run.
+- In a checkout, `tools/try-pr v0.7.6-rc1` downloads the app, checks its SHA-256 and its bundled `engine_id` against the candidate's `latest.json`, and prints the `engine_id`. It opens the app with launch arguments that make it build with its bundled engine: the stable channel, that `engine_id`, and no automatic engine or app update. The arguments last for that run. To try a change that is not pushed yet, `tools/try-local` builds the app from the checkout the same way, without CI. It is never a release: no `latest.json`, no engine signature.
- By hand: download `NX2Apple-macOS-arm64.zip` from the pre-release and unzip it. `NX2Apple.app/Contents/Resources/engine/.engine-id` is the `engine_id` of the notes. Then run `open -n NX2Apple.app --args -engineChannel stable -engineID <engine_id> -autoUpdateRepo '<false/>' -autoUpdateApp '<false/>'`.
- After the first start, with the Mac online, check the engine the app uses. It must be the `engine_id` of the candidate's `latest.json` and of its notes. Any other `engine_id` makes the test void.
- Settings, Build tools, row "Build engine": `0.7.6 · upstream <8 characters>`. The 8 characters are the start of the pin only, so they cannot tell two engines of one pin apart.
diff --git a/tools/tests/test_try_local.py b/tools/tests/test_try_local.py
new file mode 100644
index 00000000..22bab9b4
--- /dev/null
+++ b/tools/tests/test_try_local.py
@@ -0,0 +1,50 @@
+"""tools/try-local: its cache key and version string, and that its Info.plist has not drifted from the workflow's."""
+import hashlib
+import re
+import subprocess
+import sys
+import unittest
+from pathlib import Path
+
+ROOT = Path(__file__).resolve().parents[2]
+SCRIPT = ROOT / 'tools' / 'try-local'
+WORKFLOW = ROOT / '.github' / 'workflows' / 'build-mac-app.yml'
+
+
+def run(*args):
+ return subprocess.run([str(SCRIPT), *args], capture_output=True, text=True, check=True).stdout.strip()
+
+
+def plist_keys(text):
+ return [re.sub(r'\$\{\{ steps\.ver\.outputs\.version \}\}', '$V', l.strip()) for l in text.splitlines() if l.strip().startswith('<key>')]
+
+
+class TryLocal(unittest.TestCase):
+ def test_version_is_app_version_plus_local(self):
+ src = re.search(r'static let appVersion = "(.*)"', (ROOT / 'frontend/Sources/NSPortBuilder/ContentView.swift').read_text()).group(1)
+ self.assertEqual(run('--print-version'), src + '-local')
+
+ def test_cache_key_follows_the_script_and_its_pins(self):
+ key = run('--print-cache-key')
+ self.assertRegex(key, r'^[0-9a-f]{16}$')
+ self.assertEqual(key, run('--print-cache-key'))
+ h = hashlib.sha256()
+ for p in ('frontend/tools/bundle_tools.sh', 'frontend/bundled-python/requirements.txt'):
+ h.update((ROOT / p).read_bytes())
+ h.update(subprocess.run(['uname', '-m'], capture_output=True, check=True).stdout)
+ self.assertEqual(key, h.hexdigest()[:16])
+
+ def test_info_plist_matches_the_workflow(self):
+ """try-local mirrors the step 'Assemble the bundle': a key added there must be added here."""
+ mine = SCRIPT.read_text().split("<<PLIST\n", 1)[1].split("\nPLIST\n", 1)[0]
+ theirs = WORKFLOW.read_text().split("<<PLIST\n", 1)[1].split("\n PLIST\n", 1)[0]
+ self.assertEqual(plist_keys(mine), plist_keys(theirs))
+
+ def test_it_never_signs_or_publishes(self):
+ text = SCRIPT.read_text()
+ for word in ('release_manifest.py', 'gh release', 'git tag', 'git push', 'ENGINE_SIGNING_KEY'):
+ self.assertNotIn(word, re.sub(r'(?m)^#.*$', '', text))
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/tools/try-local b/tools/try-local
new file mode 100755
index 00000000..81f1dc92
--- /dev/null
+++ b/tools/try-local
@@ -0,0 +1,206 @@
+#!/usr/bin/env bash
+# Build the Mac app from this checkout on this Mac, without CI, and open it. Like tools/try-pr, for a change that is not pushed yet.
+#
+# tools/try-local build, unpack into a new folder under $TMPDIR, open
+#
+# Options:
+# --dir DIR put the app into DIR (empty or new). Default: a new folder under $TMPDIR
+# --no-open build only
+# --clean drop the cache of the bundled tools and the icon (~/Library/Caches/NX2Apple-try-local) and exit
+# --own-repo let the app choose its engine as it always does, instead of the engine tree bundled in this build
+#
+# What it builds: the same app as the job `build` of .github/workflows/build-mac-app.yml: the engine tree (tools/engine.py tree), the
+# launcher (swift build -c release), the bundled tools and Python (frontend/tools/bundle_tools.sh), the iPhone shell package, Info.plist,
+# an ad-hoc signature, and frontend/tools/check_bundle.sh. The version is <appVersion>-local.
+# It is NOT a release. It writes no latest.json, signs nothing with an engine key, touches no tag, uploads nothing. An rc tag still
+# needs CI and the owner's ENGINE_SIGNING_KEY. Without a latest.json the app has no manifest to check: it opens with the engine it
+# carries (launch arguments as in tools/try-pr: the stable channel, its engine_id, no engine or app update for this run).
+#
+# Time: the first run builds zstd, glslang, spirv-cross and downloads Python and xcodegen (the slow part). They are cached in
+# ~/Library/Caches/NX2Apple-try-local, keyed by the hash of bundle_tools.sh and bundled-python/requirements.txt (its pins). The next
+# run copies them. The icon is cached the same way, by AppIcon.icon and the Xcode version. The icon needs an Xcode whose actool reads
+# AppIcon.icon (the workflow uses Xcode 27.1). If actool fails here, the app gets the generic icon and the script says so.
+# The elapsed time of each step and the total are printed.
+#
+# Needs an Apple silicon Mac with Xcode (swift, actool), cmake and python3. The test app has the bundle id of the installed app
+# (org.nxnative.NSPortBuilder): it shares its settings and ~/Library/Application Support/NS Port Builder, .../NX2Apple and .../nxnative
+# with an installed NX2Apple, as with tools/try-pr (see its header). A setting you change in the test app stays changed.
+set -euo pipefail
+
+ROOT=$(cd "$(dirname "$0")/.." && pwd)
+CACHE=${NX2APPLE_TRY_LOCAL_CACHE:-$HOME/Library/Caches/NX2Apple-try-local}
+
+usage() { sed -n '2,10p' "$0" | sed 's/^# \{0,1\}//'; exit "${1:-0}"; }
+die() { echo "try-local: $*" >&2; exit 1; }
+note() { echo "try-local: $*"; }
+
+# Pure parts (tools/tests/test_try_local.py runs them).
+cache_key() { # the bundled tools depend on the script, its pins file and the CPU
+ cat "$ROOT/frontend/tools/bundle_tools.sh" "$ROOT/frontend/bundled-python/requirements.txt" <(uname -m) | shasum -a 256 | cut -c1-16
+}
+app_version() {
+ local src
+ src=$(sed -n 's/.*static let appVersion = "\(.*\)".*/\1/p' "$ROOT/frontend/Sources/NSPortBuilder/ContentView.swift")
+ [ -n "$src" ] || die "no appVersion in ContentView.swift"
+ echo "$src-local"
+}
+
+dir="" open_app=1 own_repo=0 clean=0 print=""
+while [ $# -gt 0 ]; do
+ case "$1" in
+ -h|--help) usage 0 ;;
+ --dir) [ $# -ge 2 ] || usage 1; dir=$2; shift ;;
+ --no-open) open_app=0 ;;
+ --own-repo) own_repo=1 ;;
+ --clean) clean=1 ;;
+ --print-cache-key) print=key ;;
+ --print-version) print=version ;;
+ *) usage 1 ;;
+ esac
+ shift
+done
+case "$print" in key) cache_key; exit 0 ;; version) app_version; exit 0 ;; esac
+if [ "$clean" = 1 ]; then rm -rf "$CACHE"; note "removed $CACHE"; exit 0; fi
+
+[ "$(uname -m)" = arm64 ] || die "this builds the arm64 app: run it on an Apple silicon Mac"
+for c in swift cmake python3 codesign; do command -v "$c" > /dev/null || die "needs $c"; done
+
+if [ -z "$dir" ]; then
+ dir=$(mktemp -d "${TMPDIR:-/tmp}/nx2apple-local.XXXXXX")
+else
+ mkdir -p "$dir"
+ [ -z "$(ls -A "$dir")" ] || die "$dir is not empty"
+fi
+dir=$(cd "$dir" && pwd)
+trap 'status=$?; [ "$status" = 0 ] || rm -rf "$dir"' EXIT
+work="$dir/work"; mkdir -p "$work"
+app="$dir/NX2Apple.app"
+
+total_start=$SECONDS
+step_start=$SECONDS
+step() { step_start=$SECONDS; note "== $*"; }
+done_step() { note " $((SECONDS - step_start)) s"; }
+
+V=$(app_version)
+cd "$ROOT"
+
+step "engine tree (tools/engine.py tree)"
+python3 tools/engine.py -q sync
+python3 tools/engine.py tree --out "$work/engine-tree"
+done_step
+
+step "swift build -c release"
+( cd frontend && swift build -c release )
+done_step
+
+step "bundled tools and Python"
+key=$(cache_key)
+tools_cache="$CACHE/tools-$key"
+if [ -f "$tools_cache/.complete" ]; then
+ note "cache hit $key"
+else
+ note "cache miss $key: building them (the slow part, once per change of bundle_tools.sh or its pins)"
+ mkdir -p "$CACHE"
+ rm -rf "$tools_cache.part"; mkdir -p "$tools_cache.part"
+ frontend/tools/bundle_tools.sh "$tools_cache.part/res" "$CACHE/work"
+ touch "$tools_cache.part/.complete"
+ rm -rf "$tools_cache"; mv "$tools_cache.part" "$tools_cache"
+ # Keep only the newest entry. The checksummed downloads stay for the next raised pin, the build folders go.
+ for old in "$CACHE"/tools-*; do [ "$old" = "$tools_cache" ] || rm -rf "$old"; done
+ rm -rf "$CACHE"/work/*-build "$CACHE"/work/zstd "$CACHE"/work/glslang "$CACHE"/work/spirv-cross "$CACHE"/work/xcodegen "$CACHE"/work/python-x
+fi
+done_step
+
+step "app icon (actool)"
+xcodev=$(xcodebuild -version 2> /dev/null | tr '\n' ' ' || echo unknown)
+icon_cache="$CACHE/icon-$(find frontend/AppIcon.icon -type f -print0 | sort -z | xargs -0 shasum -a 256 | shasum -a 256 | cut -c1-16)-$(printf '%s' "$xcodev" | shasum | cut -c1-8)"
+have_icon=0
+if [ -f "$icon_cache/Assets.car" ] && [ -f "$icon_cache/AppIcon.icns" ]; then
+ note "cache hit"; have_icon=1
+else
+ out="$work/app-icon"; mkdir -p "$out"
+ if xcrun actool frontend/AppIcon.icon --compile "$out" --platform macosx --minimum-deployment-target 13.0 \
+ --app-icon AppIcon --output-partial-info-plist "$out/partial.plist" > "$work/actool.log" 2>&1 \
+ && [ -f "$out/Assets.car" ] && [ -f "$out/AppIcon.icns" ]; then
+ mkdir -p "$icon_cache"; cp "$out/Assets.car" "$out/AppIcon.icns" "$icon_cache/"; have_icon=1
+ else
+ note "actool ($xcodev) could not compile AppIcon.icon, the app gets the generic icon. The workflow uses Xcode 27.1. Last lines:"
+ tail -5 "$work/actool.log" | sed 's/^/ /' >&2
+ fi
+fi
+done_step
+
+step "assemble the bundle (mirrors the step 'Assemble the bundle' of build-mac-app.yml)"
+mkdir -p "$app/Contents/MacOS" "$app/Contents/Resources"
+cp frontend/.build/release/NSPortBuilder "$app/Contents/MacOS/NSPortBuilder"
+if [ "$have_icon" = 1 ]; then cp "$icon_cache/Assets.car" "$icon_cache/AppIcon.icns" "$app/Contents/Resources/"; fi
+ditto "$tools_cache/res/tools" "$app/Contents/Resources/tools"
+ditto "$tools_cache/res/python" "$app/Contents/Resources/python"
+ditto "$work/engine-tree" "$app/Contents/Resources/engine"
+frontend/tools/sign_engine_tree.sh "$app/Contents/Resources/engine" "$work/engine-tree"
+rsync -a --exclude .build --exclude .swiftpm frontend-ios/ "$app/Contents/Resources/frontend-ios/"
+cat > "$app/Contents/Info.plist" <<PLIST
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleExecutable</key><string>NSPortBuilder</string>
+ <key>CFBundleIconFile</key><string>AppIcon</string>
+ <key>CFBundleIconName</key><string>AppIcon</string>
+ <key>CFBundleIdentifier</key><string>org.nxnative.NSPortBuilder</string>
+ <key>CFBundleName</key><string>NX2Apple</string>
+ <key>CFBundleDisplayName</key><string>NX2Apple</string>
+ <key>CFBundlePackageType</key><string>APPL</string>
+ <key>CFBundleShortVersionString</key><string>$V</string>
+ <key>CFBundleVersion</key><string>$V</string>
+ <key>CFBundleDevelopmentRegion</key><string>en</string>
+ <key>CFBundleLocalizations</key><array><string>en</string><string>zh-Hans</string><string>sv</string><string>de</string><string>fr</string></array>
+ <key>LSMinimumSystemVersion</key><string>13.0</string>
+ <key>NSHighResolutionCapable</key><true/>
+</dict>
+</plist>
+PLIST
+plutil -lint "$app/Contents/Info.plist" > /dev/null
+codesign --force --deep --sign - "$app"
+codesign -v --deep --strict "$app"
+done_step
+
+step "check the bundle (check_bundle.sh, as in the workflow)"
+frontend/tools/check_bundle.sh "$app" > "$work/check.log" 2>&1 || { cat "$work/check.log"; die "the bundle check failed"; }
+note "$(grep -c '^ok' "$work/check.log") checks ok"
+E="$app/Contents/Resources/engine"
+cmp "$E/.engine-id" "$work/engine-tree/.engine-id"
+cmp "$E/.upstream-ref" .upstream-ref
+test -f "$E/scripts/build_ipa_from_nsp.py" && test -f "$E/dm/tools/romfs_image.py" && test -f "$E/dm/fork_patches.txt"
+test -f "$app/Contents/Resources/frontend-ios/Package.swift" && test -d "$app/Contents/Resources/frontend-ios/AppIcon.icon"
+test ! -e "$E/.git"
+frontend/tools/sign_engine_tree.sh --check "$E" "$work/engine-tree"
+done_step
+
+rm -rf "$work"
+xattr -dr com.apple.quarantine "$app" 2> /dev/null || true
+engine_id=$(cat "$app/Contents/Resources/engine/.engine-id")
+note "NX2Apple $V built from $(git rev-parse --short=12 HEAD)$(git diff --quiet HEAD -- 2> /dev/null || echo ' + uncommitted changes')"
+note "engine_id $engine_id (Contents/Resources/engine). Not a release: no latest.json, no engine signature"
+note "total $((SECONDS - total_start)) s"
+
+args=(-autoUpdateApp '<false/>')
+if [ "$own_repo" = 0 ]; then
+ args+=(-engineChannel stable -engineID "$engine_id" -autoUpdateRepo '<false/>')
+ mine=$(defaults read org.nxnative.NSPortBuilder engineID 2> /dev/null || true)
+ if [ -n "$mine" ] && [ "$mine" != "$engine_id" ]; then args+=(-enginePreviousID "$mine"); fi
+ if [ "$(defaults read org.nxnative.NSPortBuilder engineChannel 2> /dev/null || true)" = experimental ]; then
+ note "your installed app follows the experimental channel. The test app saves stable: pick experimental again in Settings afterwards"
+ fi
+fi
+
+note "built into $dir (delete it when you are done: rm -rf $(printf '%q' "$dir"))"
+if [ "$open_app" = 0 ]; then
+ note "not opened (--no-open). To open it: open -n $(printf '%q' "$app") --args$(printf ' %q' "${args[@]}")"
+ exit 0
+fi
+if pgrep -x NSPortBuilder > /dev/null; then
+ die "NX2Apple is running. Quit it first: both copies would share one set of settings and saves"
+fi
+note "it shares settings and Application Support with an installed NX2Apple (see the top of tools/try-pr)"
+open -n "$app" --args "${args[@]}"