I have installed nginx via homebrew, by default it provides a plist which is symlinked from ~/Library/LaunchAgents and running launchctl load ~/Library/LaunchAgents/nginx.plist starts nginx as my user account.

I want nginx to be able to listen on port 443 to test some HTTPS stuff. So this means running nginx as root. By placing the plist file in /Library/LaunchAgents insetad I can run sudo launchctl load ... and nginx starts and everything runs correctly.

However, in this scenario nginx isn’t started at boot time. I must manually start nginx after every reboot.

Is it possible to have launchctl start nginx as root at bootup?

up vote 1 down vote accepted

Agents are loaded when logging in, daemons when booting. Agents are run on behalf of the user being logged in, daemons are run on behalf of root or the user/group specified by the UserName/GroupName key.

Move your job definition to /Library/LaunchDaemons and you should be fine.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.