electron-builder icon indicating copy to clipboard operation
electron-builder copied to clipboard

Mac Sonoma App Won't Open

Open ProdigyView opened this issue 4 months ago • 1 comments

  • Electron-Builder Version: v24.9.1
  • Node Version: v21.6.1
  • Electron Version: v28.2.2
  • Electron Type (current, beta, nightly): current

On Mac M1 with Sonoma 14.3.1 (23D60), I am successfully my application. The mac section in my package.json is this:

"afterSign": "build/notarize.js",
"dmg": {
      "sign": false
},
"mac": {
      "category": "public.app-category.games",
      "icon": "src/images/logo/icon.icns",
      "hardenedRuntime": true,
      "gatekeeperAssess": false,
      "entitlements": "build/entitlements.mac.plist",
      "entitlementsInherit": "build/entitlements.mac.plist",
      "extendInfo": {
        "ElectronTeamID": "xxxxxxx",
        "NSMicrophoneUsageDescription": "Please give us access to your microphone",
        "NSCameraUsageDescription": "Please give us access to your camera",
        "NSScreenRecordingUsageDescription": "Please give us access to record your screen",
        "com.apple.security.device.audio-input": true,
        "com.apple.security.device.camera": true,
        "com.apple.security.screen-recording": true
      },
      "target": {
        "target": "default",
        "arch": [
          "x64",
          "arm64"
        ]
      }
    }

It produces an arm64.dmg and a intel dmg, but when I go run my application, I get this:

    open -a MyApp.app                      
The application /Volumes/MyApp 1.5.7-arm64/MyApp.app cannot be opened for an unexpected reason, error=Error Domain=RBSRequestErrorDomain Code=5 "Launch failed." UserInfo={NSLocalizedFailureReason=Launch failed., NSUnderlyingError=0x600002977780 {Error Domain=NSPOSIXErrorDomain Code=153 "Unknown error: 153" UserInfo={NSLocalizedDescription=Launchd job spawn failed}}}

Here are my entitlements:

<?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>com.apple.security.cs.allow-jit</key>
    <true/>
    <key>com.apple.security.cs.allow-unsigned-executable-memory</key>
    <true/>
    <key>com.apple.security.cs.allow-dyld-environment-variables</key>
    <true/>
    <key>com.apple.security.device.microphone</key>
    <true/>
    <key>com.apple.security.device.audio-input</key>
    <true/>
    <key>com.apple.security.device.camera</key>
    <true/>
    <key>com.apple.security.screen-recording</key>
    <true/>
    <key>LSApplicationCategoryType</key>
    <string>public.app-category.games</string>
  </dict>
</plist>

And my build/notarize.js:

const { notarize } = require('electron-notarize');

exports.default = async function notarizing(context) {
  const { electronPlatformName, appOutDir } = context;
  if (electronPlatformName !== 'darwin') {
    return;
  }

  const appName = context.packager.appInfo.productFilename;

  return await notarize({
    appBundleId: 'com.invirtu.glitch',
    appPath: `${appOutDir}/${appName}.app`,
    appleId: "xxxxxx",
    appleIdPassword: "xxxxxxxx",
    ascProvider: "xxxxxx"
  });
};

Any idea on what can be causing the app not to open? It's built correctly before in the past.

ProdigyView avatar Feb 13 '24 12:02 ProdigyView

Have you checked out this issue? https://forums.developer.apple.com/forums/thread/666611?page=5

Looks like it might be related to signing credentials or entitlements?

Can you try next electron-builder v24.13.0, there were some changes related to extendInfo for merging with app entitlements

mmaietta avatar Feb 13 '24 16:02 mmaietta