site_archiver@lists.apple.com Delivered-To: installer-dev@lists.apple.com Step 1: find a process running as the current user and get its PID: (Current username in $USER) PSOUT=`ps auxwww | grep Finder | grep $USER | grep -v grep` PID=`echo $PSOUT | cut -d" " -f2` -Greg On Mar 19, 2010, at 2:58 AM, Chris Adamson wrote: Thanks in advance. --Chris _______________________________________________ Do not post admin requests to the list. They will be ignored. Installer-dev mailing list (Installer-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/installer-dev/greg.neagle%40disneyani... _______________________________________________ Do not post admin requests to the list. They will be ignored. Installer-dev mailing list (Installer-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/installer-dev/site_archiver%40lists.a... Yes, but it's fragile, and will probably break in future releases of the OS. With each release of OS X, Apple makes it harder and harder for a root process to operate in a user's context. This works only for the currently logged in user; any users logged in but switched out via fast user switching don't get to play. Step 2: use a very complicated call to launchctl to start the agent in the user's context: /bin/launchctl bsexec $PID /usr/bin/sudo -u $USER /bin/bash -c 'unset SUDO_COMMAND ; /bin/launchctl start com.myorg.mylaunchagent' I suppose you could figure out all the currently logged in users and repeat this process for each one to handle the FUS users as well. If it were me, I'd just require a logout (if I didn't care about supporting Fast User Switched users), or a restart (if it was important that everyone got the new functionality). We're installing a LaunchAgent that we want to get up and running immediately, so in a post-install script, we call "launchctl load / Library/LaunchAgents/path.to.our.agent.plist". I've noticed that this runs the agent as root, whereas the agent will run as the user on subsequent logins. Is there a way to get the agent running as the user who's performing the install, rather than root? This email sent to greg.neagle@disneyanimation.com This email sent to site_archiver@lists.apple.com