Skip to content

feat: add --install flag to auto-install macOS apps to /Applications#1144

Merged
tw93 merged 3 commits intotw93:mainfrom
chindris-mihai-alexandru:feat/auto-install-macos
Mar 9, 2026
Merged

feat: add --install flag to auto-install macOS apps to /Applications#1144
tw93 merged 3 commits intotw93:mainfrom
chindris-mihai-alexandru:feat/auto-install-macos

Conversation

@chindris-mihai-alexandru
Copy link
Copy Markdown

Summary

  • Add a new --install CLI flag that automatically installs built macOS apps to /Applications and removes the installer DMG after a successful build
  • Eliminates the manual mount → drag → unmount → delete workflow for every pake build on macOS

Closes #1143

Changes

File Change
bin/types.ts Add install: boolean to PakeCliOptions
bin/defaults.ts Default install: false
bin/helpers/cli-program.ts Register --install CLI option (visible in help)
bin/builders/BaseBuilder.ts Add installDmgToApplications() method + call site after build success
tests/unit/cli-options.test.ts Add test for --install option registration

How it works

When --install is passed on macOS with a DMG target:

  1. Mounts the DMG via hdiutil attach
  2. Copies the .app to /Applications (replaces existing if present)
  3. Unmounts via hdiutil detach
  4. Removes the installer DMG

On failure, the DMG is preserved and an error is logged.

Usage

pake https://example.com --name "MyApp" --install

Design decisions

  • Opt-in only — defaults to false, zero impact on existing workflows
  • macOS-only — guarded by IS_MAC && fileType === 'dmg' (future Linux/Windows support could follow separately)
  • Graceful degradation — if install fails, the DMG remains and an error message points to it
  • Uses execa directly — avoids shellExec which is tied to npmDirectory as cwd
  • Visible in --help — not hidden, since it's a user-facing quality-of-life feature

Testing

  • Unit test added for option registration (all 3 tests pass)
  • Manually tested end-to-end: built and auto-installed LinkedIn and NoteBookLM apps to /Applications successfully

Add a new --install CLI option that, after a successful macOS DMG build,
automatically mounts the DMG, copies the .app bundle to /Applications
(replacing any existing version), unmounts the volume, and removes the
installer DMG.

This eliminates the manual mount-drag-unmount-delete workflow that users
must perform after every build.
Copilot AI review requested due to automatic review settings March 3, 2026 17:57
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an opt-in --install flag to the Pake CLI to automatically install a successfully built macOS DMG’s .app into /Applications, and (on success) remove the generated DMG to eliminate the manual mount/copy/unmount/delete workflow.

Changes:

  • Add install: boolean to CLI options + defaults.
  • Register --install as a visible CLI flag.
  • Add DMG post-build installation flow in BaseBuilder (and compiled dist/cli.js), plus a unit test for flag registration.

Reviewed changes

Copilot reviewed 1 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
bin/types.ts Adds install option to PakeCliOptions.
bin/defaults.ts Defaults install to false (opt-in).
bin/helpers/cli-program.ts Registers --install flag in Commander help/options.
bin/builders/BaseBuilder.ts Implements installDmgToApplications() and calls it after DMG build success.
tests/unit/cli-options.test.ts Verifies --install option is registered with default false.
dist/cli.js Updates compiled CLI output to include new option + install logic.

Use a temporary mountpoint for DMG installation to avoid failures caused by
volume-name mismatches or already-mounted /Volumes entries. Discover the app
bundle from the mounted image, always cleanup mount resources in finally, and
force-detach as a fallback.
@chindris-mihai-alexandru
Copy link
Copy Markdown
Author

Quick update: I pushed a follow-up fix commit to harden the macOS --install flow.

What was fixed:

  • Avoided fragile /Volumes/<AppName> assumptions by mounting DMG to a unique temp mountpoint
  • Added -nobrowse -readonly -mountpoint for safer scripted attach behavior
  • Detect the .app bundle from mounted contents instead of relying on exact app name/path
  • Added robust cleanup in finally (detach + remove temp mount dir), with detach -force fallback

Why this matters:

  • Prevents failures when volume names differ, collide, or are already mounted
  • Prevents leaked mounts on partial failures

Validation:

  • pnpm run cli:build passed
  • pnpm test passed (full suite)
  • End-to-end real run verified: app installed to /Applications and DMG removed

@tw93 tw93 merged commit f01a798 into tw93:main Mar 9, 2026
5 checks passed
@tw93
Copy link
Copy Markdown
Owner

tw93 commented Mar 9, 2026

Thanks for the PR. I pushed a maintainer follow-up directly to your branch to simplify the macOS flow: instead of building a DMG and mounting it, we now build a standard Tauri bundle and copy it directly into . I also added CLI docs in both English and Chinese, rebuilt , and re-ran the test suite.\n\nI also verified the end-to-end install flow locally on macOS. The PR is now merged into . Appreciate you opening this and getting the feature started.

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.

Feature: --install flag to auto-install macOS apps to /Applications

3 participants