Skip to content

Pack a Mac app into a disk image with a ready-made window - #302

Closed
marcolaux wants to merge 1 commit into
seedds:mainfrom
marcolaux:feature/mac-dmg
Closed

marcolaux wants to merge 1 commit into
seedds:mainfrom
marcolaux:feature/mac-dmg

Conversation

@marcolaux

@marcolaux marcolaux commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Packs a Mac app into a disk image (a .dmg) that opens with a ready-made window: the game on the left, a symlink to /Applications on the right, an arrow between the two, the game's name on the background and the game's own icon on the volume.

python3 scripts/mac_dmg.py "<NSP folder>/<game name>.app"

The app bundle is not changed: it is copied into the image. The image is built read-write (the Finder writes the window's layout and the volume's icon into it) and then converted to a compressed read-only image, so the finished .dmg opens with the same window on every Mac. Dragging the app to /Applications copies it there; nothing is installed.

How the layout is written: the Finder is told over AppleScript to open the disk in an icon view at a fixed size, to place the two items and to set the background. The places the Finder puts the items are read back and the background is drawn in exactly those coordinates, so the arrow lands between the icons on every Mac.

The options: --out (where the image is written, the app's own folder by default), --name (the image's name, the app's display name by default), --format (udzo by default, ulfo smaller but slower, u3zo larger, udrw none), --title (the name on the background), --window W H, --icon-size, --no-layout (no window layout at all, and no permission to control the Finder needed), --verify (check the finished image) and --keep (keep the read-write image).

The script needs the permission to control the Finder (System Settings › Privacy & Security › Automation); without it, or with --no-layout, the image is built but opens in the Finder's own view. The background is drawn with Pillow (python3 -m pip install pillow); without it the image is built without one, the rest of the layout unchanged.

🤖 Generated with Claude Code

scripts/mac_dmg.py copies a Mac app into a .dmg that opens with the game's
icon on the left, a symlink to /Applications on the right, an arrow between
the two, the game's name on the background and the game's own icon on the
volume. The app bundle is not changed: it is copied into the image, which
is built read-write (the Finder writes the window's layout and the volume's
icon into it) and then converted to a compressed read-only image, so it
opens the same way on every Mac.

The layout is written in two passes: the Finder places the two icons and
reads back where it put them, and the background is drawn in exactly those
coordinates, so the arrow lands between the icons on every Mac. Without
the permission to control the Finder (or with --no-layout) the image is
built without a layout.

Co-Authored-By: Claude Code <noreply@anthropic.com>
@v0lumehi

Copy link
Copy Markdown
Contributor

Nice work on the Finder layout! Out of curiosity, what's the use case you have in mind? For my own builds I just move the .app to /Applications.

One concern worth raising before this lands: a --platform mac-app bundle contains the game's own files (RomFS, the rewritten modules, the shaders). A polished .dmg is the format people use to hand an app to someone else, so a script that turns a built game into one makes sharing games very easy. That's the line this project has been careful not to cross, and I think it's worth @seedds weighing it explicitly. If the goal is a nicer install, maybe an --install option that clones the app into /Applications (APFS clone, no extra space) would get the same convenience without producing a shareable image?

@github-actions github-actions Bot added tools Tools and scripts (dm/tools, scripts) docs Documentation labels Nov 3, 2026
ltrdpper pushed a commit to ltrdpper/BananaNative that referenced this pull request Nov 16, 2026
The game sizes its scenes by the operation mode and the Switch 2 graphics scale
(one function of nro0 1.1.1); its smallest Horizon answer is handheld scale 2,
1280x720. graphics_scale rows give Original / 1440p (console scale 1, the game's
2048x1152 start, still the default through android_window original), 1080p
(handheld 0) and 720p (handheld 2). 540p is handheld scale 2 plus
DM_GRAPHICS_SIZE=960x540: an observation gate where the size function's paths
join writes the smaller size, never above the game's own pick.

The launcher passes DM_GRAPHICS_SIZE for a graphics_scale row whose scale and
mode a larger row also has. The in-game panel sets the scale, mode and size in
one host call (nxhost_graphics_set) with one notification 300, so 540p -> 1080p
does not pass through 720p. nro0's build ID goes in a new nro_build key: in the
build row, the dump check looked for nro0 in the ExeFS.

Refs seedds#302, seedds#307

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Lh8PXU5UbYtcjyspYPzhV7
ltrdpper pushed a commit to ltrdpper/BananaNative that referenced this pull request Nov 16, 2026
@seedds

seedds commented Nov 29, 2026

Copy link
Copy Markdown
Owner

Thanks for putting together the Finder-layout .dmg packager, @marcolaux.

We're closing this PR because the existing .app bundle workflow already works for local Mac use without adding a 390-line disk-image script, and as noted in the thread, built app bundles contain the user's own game files and aren't meant to be packaged into distributable .dmg installers. The script recipe remains here in the thread for reference.

@seedds seedds closed this Nov 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation tools Tools and scripts (dm/tools, scripts)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants