Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What makes an OS X app not open with the error "LSOpenURLsWithRole() failed with error -10810"?

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.
like image 438
curiousdannii Avatar asked Jan 23 '15 08:01

curiousdannii


1 Answers

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
like image 86
Alexander O'Mara Avatar answered Sep 27 '22 16:09

Alexander O'Mara