Run caddy on macOS startup

Trying to get Caddy Server to start every time macOS boots, but can’t seem to get it going. Followed the steps here exactly. Modified paths to match my own, etc. etc. with no luck.

It appears the launchd service works, because after a reboot if I try to run “launchctl load /Library/LaunchDaemons/com.caddyserver.web.plist” it says the service is already running. However, I can confirm caddy is not running and I still need to manually go into terminal and run the caddy command to get the server started.

Any ideas on why this might be happening?

What’s in your /etc/caddy/Caddyfile?

You can run ps -aux | grep caddy to see if the process is in fact running.

It’s possible it is in fact launching, but issues with the Caddyfile might see it serving nothing on port 2015 by default.

Can’t hurt to add -log stdout to the ProgramArguments array either and check /var/log/caddy/info.log.

Not sure what happened, but somehow got it to work. I reinstalled caddy with the hook.service plugin installed and used the plugin to run Caddy as a service. I think maybe that did it! Thanks!

1 Like

Wait, scratch that…as mysteriously as it started working, it just stopped again consistently :frowning:
Here is my caddyfile: my.domain.com { ext .html .htm .php root /www/caddy tl - Pastebin.com (replaced domain and emails for privacy)
I’m pretty sure the file is working fine though, because when I manually run caddy with caddy, everything works perfectly.

When I run -aux | grep caddy I get: ps: no user named ‘x’

Another curious thing…If I “manually” restart macOS, it seems to work. But I have scheduled restarts in Engery Saver that happens every night at 4am and when the computer restarts that way, Caddy doesn’t launch. (I can confirm, a different launchd service I have does launch on boot every single time, regardless of how macOS restarts)

Oh, uhh, try just ps -a | grep caddy.

Also try cat /var/log/caddy/info.log, it might have information for you.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.