views:

69

answers:

2

Hi,

I have created a minimal OS X boot stick (basically the Snow Leopard DVD with all the packages and installer stripped out). I've written a basic Cocoa app launcher to launch other apps that I put in the Applications folder (the minimal install lacks Dock and Finder).

When I try to launch an app I get this error:

LSOpenFromURLSpec() returned -10810 for application (null) path /Applications/MyApp.app

Where "MyApp.app" is the app I tried to launch. I've tried this with both NSWorkspace's openFile method and the UNIX "open" utility and I get more or less the same error. One way that launching an app works is if I just execute the main executable of the app itself. (e.g. /Applications/MyApp.app/Contents/MacOS/MyApp). However this method is kind of inconvenient as it stalls the launcher until the app I launched exits. Any alternate ways to launch an app (or fix the LSOpenFromURL error)?

Thanks

A: 

Found a workaround:

/Applications/MyApp.app/Contents/MacOS/MyApp >/dev/null 2>/dev/null &

Using that command starts apps without stalling the launcher.

macatomy
A: 

open relies on Launch Services, which relies on the Finder. Your script workaround starts a new background process executing the application's code with its standard out and standard error open to /dev/null. That should work fine.

The C equivalent under Mac OS X would be to either posix_spawn or fork/vfork then exec the executable file.

Jeremy W. Sherman