Requirements to use 'open -b "bundle.id" ' for OS X

I have a post install script which opens and runs my application silently. The app was made using Automator and basically runs an Applescript which in turn runs a Bash script embedded from the app Resources folder.

The postinstall script:

#!/bin/bash

open -b "com.company.ApplicationName"

works on some machines and not others. I'm receiving an error

LSGetApplicationForInfo() failed with error -10814 while trying to determine the application with bundle identifier com.company.ApplicationName

I have not been able to determine why. I'm assuming I'm missing some kind of prerequisite software on the machines failing.

Anyone aware of the requirements to use open -b "bundleid"? Xcode, Xcode with Command Line Tools or something? I'd appreciate any insight.


My guess is that it is working on systems where the app has been present long enough for the app to be registered with the system, but fails on systems where it has not been present very long.

There is a possible solution here:

The command (all one line)

/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain system -domain user

The Caveat

After running this command, OS X may prompt you before letting you open some applications for the first time. I would NOT suggest running that on someone else's Mac or they are likely to get irritated with you.

Instead, I would suggest using open -a /path/to/your/app instead of open -b {bundle-id}