[launchd-dev] LoginItem issue on Tiger

Quinn eskimo1 at apple.com
Fri May 29 03:00:08 PDT 2009


At 12:18 +0530 29/5/09, Arjun SM wrote:
>     what i mean by this is that ... in my postflight i would use 
>"open <path to my application>" . This would no doubt launch my app 
>, but i wanted to know if this is a good way of overcoming the 
>problem?? what are its implications ??

That's a perfectly reasonable approach.  There are two major gotchas, 
both of which also affect the launchd agent case:

o privileges -- If you're installer runs with privileges, you have to 
make sure you switch to the user ID of the user running the installer 
before launching the agent.  In the launchd case, failing to do this 
will launch the agent in the global launchd, and no good can come of 
that.  In the login item case, failing to do this will launch the 
application as root, which is also not good.

o remote install -- Neither approach will work in the remote install 
case.  Most admins do remote installs over SSH, which means that the 
installer is running in a non-GUI context.  Trying to start a launchd 
agent or a login item in that context will end badly.  You will need 
to detect that case and not start the agent/login item.

S+E
-- 
Quinn "The Eskimo!"                    <http://www.apple.com/developer/>
Apple Developer Relations, Developer Technical Support, Core OS/Hardware


More information about the launchd-dev mailing list