0

I am trying to create a program to pack Lua scripts into a .app file, and am having trouble with running the app.

To test, I got a working program and put it in MyApp.app/Contents/MacOS/main (This program has UI), and setup MyApp.app/Contents/Info.plist like this

<?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>CFBundleDevelopmentRegion</key>
    <string>English</string>
    <key>CFBundleExecutable</key>
    <string>msain</string>

    <key>CFBundleIconFile</key>
    <string></string>
    <key>CFBundleIdentifier</key>
    <string>net.frityet.test</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>Test</string>
    <key>CFBundlePackageType</key>
    <string>APPL</string>
    <key>CFBundleShortVersionString</key>
    <string>1.0.0</string>
    <key>CFBundleSignature</key>
    <string>????</string>
    <key>CFBundleVersion</key>
    <string>1</string>
    <key>LSMinimumSystemVersion</key>
    <string>10.14</string>
    <key>NSHighResolutionCapable</key>
    <true/>
    <key>NSPrincipalClass</key>
    <string>NSApplication</string>
    <key>NSAppTransportSecurity</key>
    <dict>
        <key>NSAllowsArbitraryLoads</key>
        <true/>
    </dict>
</dict>
</plist>

Error from open

The application cannot be opened for an unexpected reason, error=Error Domain=RBSRequestErrorDomain Code=5 "Launch failed." UserInfo={NSLocalizedFailureReason=Launch failed., NSUnderlyingError=0x7fa445911ca0 {Error Domain=NSPOSIXErrorDomain Code=111 "Unknown error: 111" UserInfo={NSLocalizedDescription=Launchd job spawn failed}}}
Frityet
  • 1
  • 1
  • 2
    `msain` < Is it as simple as the typo on "main"? – TheNextman Jan 16 '23 at 20:44
  • macOS version? Any other commands besides open? Codesign? – Richard Barber Jan 16 '23 at 21:12
  • @TheNextman nope, unfortunately – Frityet Jan 30 '23 at 20:18
  • @RichardBarber Ventura 13.1, I am making a tool to make an .app file, so command line tools are A-ok, not GUI ones – Frityet Jan 30 '23 at 20:18
  • An .app isn't a file, it's a several files with a specific structure. I don't believe you can wrap an arbitrary binary inside a .app and expect macOS to run it as an "application" - it's implied that your binary will be run as `NSApplication`, with the necessary delegates and etc (see for instance the `NSPrincipalClass` key in your Info.plist). I think we need more information about your binary. If it's just a CLI utility, it should just be a standalone binary. – TheNextman Jan 30 '23 at 20:29
  • There is a typo in the spelling of the executable still. – Richard Barber Jan 31 '23 at 20:00
  • Also for Ventura you need to codesign the app, at least *ad hoc* using `-`. – Richard Barber Jan 31 '23 at 20:03

0 Answers0