Skip to content

fix: correct path derivation in macOS update restart script#137

Merged
j4rviscmd merged 1 commit into
mainfrom
fix/fix-update-path
May 22, 2026
Merged

fix: correct path derivation in macOS update restart script#137
j4rviscmd merged 1 commit into
mainfrom
fix/fix-update-path

Conversation

@j4rviscmd
Copy link
Copy Markdown
Owner

Summary

Fix the macOS auto-update restart failure caused by incorrect path calculation in applyDmgUpdateOnQuit().

Problem

After downloading and extracting the update DMG, clicking "Install & Restart" would:

  1. Show "Installing..." (DMG extraction - works correctly)
  2. Show "Restarting..." (triggers quit + update script)
  3. App closes successfully
  4. App never restarts and version remains unchanged

Root Cause

In codermUpdateService.darwin.ts, the applyDmgUpdateOnQuit() method used path.dirname() twice on currentAppPath:

const currentAppPath = electron.app.getAppPath().split('.app')[0] + '.app';
// e.g. currentAppPath = '/Applications/Coderm.app'
const parentDir = path.dirname(path.dirname(currentAppPath));
// path.dirname('/Applications/Coderm.app') → '/Applications'
// path.dirname('/Applications') → '/'  ← BUG: resolves to root!

This caused the update shell script to target /Coderm.app instead of /Applications/Coderm.app, resulting in permission errors and failed restart.

Fix

Remove the extra path.dirname() call:

- const parentDir = path.dirname(path.dirname(currentAppPath));
+ const parentDir = path.dirname(currentAppPath);

Now parentDir correctly resolves to /Applications (or wherever the app is installed), and the update script properly replaces and relaunches the application.

The applyDmgUpdateOnQuit() method used path.dirname() twice on
currentAppPath, which resolved to '/' instead of the app's parent
directory (e.g. '/Applications'). This caused the update shell script
to target '/Coderm.app' rather than '/Applications/Coderm.app',
resulting in a failed restart after update installation.
@j4rviscmd j4rviscmd added the bug Something isn't working label May 22, 2026
@j4rviscmd j4rviscmd merged commit 2f21dae into main May 22, 2026
3 checks passed
@j4rviscmd j4rviscmd deleted the fix/fix-update-path branch May 22, 2026 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant