launchd plist -- userid, home directory

Rainer Müller raimue at
Thu Feb 4 06:41:23 PST 2016

On 2016-02-04 15:15, Craig Treleaven wrote:
> I was looking at modifying the buildbot / buildbot-slave ports to include a sample launchd plist.  I would like to be able to default the UserName and WorkingDirectory keys for the userid that is installing the port.
> <key>UserName</key>
> <string>@someusername@</string>
> <key>WorkingDirectory</key>
> <string>/Users/@someusername@/buildarea</string>
> For example, if I’m installing the port and my userid is ‘wct’, I’d like to s/@someusername@/wct’/g .  
> Within the portfile, how can I determine the userid that invoked ‘port install …'?

I would advise against doing this. The installed sample files would
change depending on the user that ran the port command. The contents of
all files installed by a port should be reflected by the canonical
identifier of name/version/revision/epoch/variants.

Also this would not help if the user installs the port with a binary
archive from one of our buildbots, they would always get a pre-defined

Wouldn't it make more sense to create a dedicated user to run the
buildbot daemon? See add_users in portfile(7) and grep for examples in
the ports tree. If you use some working directory in ${prefix}/var/ it
could even be used out of the box without further configuration.



More information about the macports-dev mailing list