User for startupitem.executable

Rainer Müller raimue at
Sun Sep 18 07:16:19 PDT 2016

On 2016-09-17 17:12, Javier Alcázar wrote:
> I'm creating a new Portfile with startupitem.executable, and wondering
> what is the best way to execute the command with a specific user.

Just for the future, Portfile development is usually discussed on
macports-dev, where you would reach more developers. The discussion on
macports-users is about usage of the port command and problems with
installs and upgrades.

> I tried using "su -c executable args" but with this approach
> launchd ends up monitoring the "su" process instead of the "executable"
> What would you recommend to do so launchd looks at the "executable" process?

A few ports use this approach, citing from the mongodb port:

  startupitem.executable  sudo -u ${mongouser} ${prefix}/bin/mongod ...

While this adds an additional processes to the hierarchy, I do not see
any problem with that. The su/sudo keeps running until the command exits
and any signals sent to su/sudo will be relayed to the executed process.


More information about the macports-users mailing list