macOS
You can install cloudflared
as a system service on macOS.
Before you install Cloudflare Tunnel as a service on your OS, follow Steps 1 through 4 of the Tunnel CLI setup guide. At this point you should have a named tunnel and a config.yml
file in your $HOME/.cloudflared
directory.
By default, Cloudflare Tunnel expects all of the configuration to exist in the $HOME/.cloudflared/config.yml
configuration file. At a minimum you must specify the following arguments to run as a service:
Argument | Description |
---|---|
tunnel | The UUID of your tunnel |
credentials-file | The location of the credentials file for your tunnel |
You can install the service to either run at login or at boot.
Open a terminal window and run the following command:
Cloudflare Tunnel will be installed as a launch agent and start whenever you log in, using your local user configuration found in ~/.cloudflared/
.
Open a terminal window and run the following command:
Cloudflare Tunnel will be installed as a launch daemon and start whenever your system boots, using your configuration found in /etc/cloudflared
.
Run the following command:
The output will be logged to /Library/Logs/com.cloudflare.cloudflared.err.log
and /Library/Logs/com.cloudflare.cloudflared.out.log
.
You can now route traffic through your tunnel. If you add IP routes or otherwise change the configuration, restart the service to load the new configuration: