0

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?

1

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 agree to our terms of service, privacy policy and cookie policy

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