macos-app-multi-instanceslisted
Install: claude install-skill soulmachine/skills
# Run several instances of a macOS app
Duplicate and re-sign a macOS app bundle so each copy runs as a separate process the OS treats as a different app: its own sandbox container, its own login session, running alongside the original. Verified on WeChat 4.1.15 (Tencent, App Store, sandboxed): two accounts logged in at once, each in its own container, on 2026-10-25.
## Facts every step rests on
- **`open -n -a` is not the fix.** It forces a new *launch request*, but an app with its own single-instance IPC check (most chat/IM apps) just detects the sibling and refocuses it — no new process shows up in `pgrep`.
- **The container follows the bundle ID, not the code signature.** A sandboxed app's data lives at `~/Library/Containers/<CFBundleIdentifier>/`. Change the identifier in a copy and macOS hands it a fresh, empty container at launch.
- **A plain ad-hoc re-sign drops the sandbox.** `codesign --force --deep --sign -` keeps no entitlements, so the copy runs unsandboxed. WeChat still builds its data path under `~/Library/Containers/<id>/`, but other apps may not.
- **Keeping the sandbox needs care.** An ad-hoc signature cannot carry `com.apple.application-identifier` or `com.apple.developer.team-identifier`; drop them. Keep `com.apple.security.application-groups`, renamed to match the copy (`5A4RE8SF68.com.tencent.xinWeChat` → `…xinWeChat2`): sandboxed WeChat registers Mach services under that name and dies 1 s after launch (`deny mach-register …MachPortRendezvousServer`) w