1

I have an OSX application providing a service menu to other applications. This works fine so far, the menu is activated and available after a user installed the app and logged out and back in. (see similiar post)

I know the log-out-and-back-in is obsolete when triggering the service menu agent (pbs) to scan for changed services by opening a terminal and running /System/Library/CoreServices/pbs (this also works without having the new application launched even once)

So I´d like to provide an installer (.pkg) which runs "pbs" as post-install script. Suprisingly, running "bps" as post-install only works if the application was launched before e.g.: #! /bin/sh

sleep 3
open /Applications/MyApp.app
sleep 3
/System/Library/CoreServices/pbs
exit 0

Unfortunately, (due to application specific reasons) I do not want to start my application directly from the installer. Does anyone know why the post-install-scrips behaves different than the Terminal?

Community
  • 1
  • 1
seb
  • 196
  • 2
  • 8

2 Answers2

0

Depending on the rights the Installer requires the post-install scripts maybe runs as root user. Try:

sleep 3
su -l "${USER}" -c "open /Applications/MyApp.app"
sleep 3
su -l "${USER}" -c "/System/Library/CoreServices/pbs"
exit 0
catlan
  • 25,100
  • 8
  • 67
  • 78
  • Thanks for your reply. Unfortunately, running `pbs` as user in the post-install script still dosen´t work unless the application was launched before. – seb Oct 12 '12 at 14:59
0

Eventually, as a workarround, I am going to start my application hidden and stopping it again before running pbs. Still looking forward for a better solution.

seb
  • 196
  • 2
  • 8