6

I am working on what should be a very simple application bundle for OS X. My OS is version 10.7.5. The app in this case is a shell script.

Kerkerkruip.app/Contents/Info.plist:

<?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>CFBundleExecutable</key>
    <string>Kerkerkruip</string>
    <key>CFBundleIconFile</key>
    <string>Kicon.icns</string>
    <key>CFBundleIdentifier</key>
    <string>org.kerkerkruip.Kerkerkruip</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>Kerkerkruip</string>
    <key>CFBundlePackageType</key>
    <string>APPL</string>
    <!--<key>CFBundleSignature</key>
    <string>????</string>-->
    <key>CFBundleVersion</key>
    <string>9.0.1</string>
    <key>LSMinimumSystemVersion</key>
    <string>10.4</string>
    <key>NSHumanReadableCopyright</key>
    <string>© 2011-2015 by the Kerkerkruip team</string>
    <!--<key>NSMainNibFile</key>
    <string>MainMenu</string>-->
    <!--<key>NSPrincipalClass</key>
    <string>NSApplication</string>-->
</dict>
</plist>

Kerkerkruip.app/Contents/MacOS/Kerkerkruip:

#!/usr/bin/env bash
echo "This is a blank script." 1>&2
exit 1

When I try to open the app I get the following error message:

$ open Kerkerkruip.app/
The application cannot be opened because it has an incorrect executable format.

The script is set +x. I have seen this question on SuperUser but nothing there helped - my script is over 27 characters.

Edit: After following the instructions in this other question to rebuild the Launch Services database for my app, trying to open it now produces:

LSOpenURLsWithRole() failed with error -10810 for the file /Users/dannii/Documents/kerkerkruip/packages/osx/Kerkerkruip.app.
Community
  • 1
  • 1
curiousdannii
  • 1,658
  • 1
  • 25
  • 40

1 Answers1

4

I did some testing, and was able to reproduce your second error.

LSOpenURLsWithRole() failed with error -10810 for the file /PATH/TO/Kerkerkruip.app.

After experimentation, it looks like the issue is caused by your shell script exiting with the error code of 1. If you exit with the success code of 0, the error does not occur.

Example:

#!/usr/bin/env bash
echo "This is a blank script." 1>&2
exit 0
Community
  • 1
  • 1
Alexander O'Mara
  • 58,688
  • 18
  • 163
  • 171
  • Quite right, I feel rather dumb. That's what you get for copying code without thinking about it. But no commands in the script file display anything in the console window... I've tried a few stream redirecting options but they don't seem to make a difference. – curiousdannii Jan 30 '15 at 07:52
  • Ah, I've discovered that the open command basically sends stdout to /dev/null. That's okay, I can make do. – curiousdannii Jan 30 '15 at 08:21
  • You can change this `open` redirection from within your shell script to debug it with the construct: `exec 2 >/Users/dannii/...`. – dan Aug 24 '21 at 10:05