0

I have created a OS X launch agent that is installed per user. It is listening socket and automatically launched when socket connection arrives. On my .plist I have

    <key>ProgramArguments</key>
    <array>
<string>~/Library/Containers/com.mycompany.myproduct/myproduct.app/Contents/MacOS/myproduct</string>
    </array> 

When connecting to my launch agent socket I get a message in console saying my launch agent is not found. When changing .plist ProgramArguments to

<string>/Users/myusername/Library/Containers/com.mycompany.myproduct/myproduct.app/Contents/MacOS/myproduct</string>

Launch agent is loaded correctly. So it looks like I need to modify .plist for each user during launch agent installation. How can I do this automatically or easily? Is there a standard way for this? Or should I do something totally differently here to achieve what I want?

3
  • Why not install for all users and so in /Library/Containers/com.mycompany.myproduct/....
    – mmmmmm
    Jul 1, 2013 at 12:42
  • Mark, my user agent is a helper app for Mac App Store app - should I then install it for all users? Users can download the helper from my website to extend main app functionality beyond sandbox limits. If yes I should probably also move launch agent from ~/Library/LaunchAgents/ to /Library/LaunchAgents/ ?
    – superg
    Jul 1, 2013 at 13:04
  • Also, there is no directory /Library/Containers/ on my Mac, should I just create one for my launch agent to work?
    – superg
    Jul 1, 2013 at 14:49

1 Answer 1

1

Use EnableGlobbing:

<key>EnableGlobbing</key>
<true/>
<key>ProgramArguments</key>
<array>
    <string>~/Library/Containers/com.mycompany.myproduct/myproduct.app/Contents/MacOS/myproduct</string>
</array> 

It works with ProgramArguments but not with Program.

3
  • I thought there is something like this, but never seen it before. Brilliant.
    – superg
    Jul 1, 2013 at 12:59
  • Based on documents this is what I need, but after adding EnableGlobbing to my plist I still get the same error.
    – superg
    Jul 1, 2013 at 14:26
  • I solved the problem by installing launch agent to /Library/LaunchAgents.
    – superg
    Jul 3, 2013 at 6:27

You must log in to answer this question.

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