0

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.

1
  • 1
    You could also have tried using something like osascript -e 'tell app id "com.company.ApplicationName"' -e reopen -e activate -e end. – Lri Aug 22 '13 at 5:16
1

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}

2
  • Thanks for the suggestions. The problem is, I'm deploying this with Munki and using a post install script to automatically open it. It is possible it will be installed in different paths so using bundle id is my only real option. Also as far as killing the lsregister, I would need to hit each machine and ARD isn't all that useful in our environment (one of the reasons we are now using Munki). – TryTryAgain Aug 21 '13 at 19:45
  • I have sent out an update to the app, as a solution, giving it time to register the bundle id. Without any extra installed software, they appear to have no issue opening the app using open -b "app.bundle.id" so yes, it must have just been an issue with time and the bundle id not being registered. Thanks again for your input and help. – TryTryAgain Aug 21 '13 at 22:09
0

To unregister a specific application (the one that makes troubles, say /Applications/AppName.app) from the LaunchServices database, run:

/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -u /Applications/AppName.app/

Then re-launch the app in Finder to register it again.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .