macOS (3)

Last updated Sep 11, 2026 You can install cloudflared as a system service on macOS.

Prerequisites

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.

1. Configure cloudflared as a service

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

2. Run cloudflared as a service

You can install the service to either run at login or at boot.

Run at login

Open a terminal window and run the following command:

cloudflared service install

Cloudflare Tunnel will be installed as a launch agent and start whenever you log in, using your local user configuration found in ~/.cloudflared/.

Run at boot

Open a terminal window and run the following command:

sudo cloudflared service install

Cloudflare Tunnel will be installed as a launch daemon and start whenever your system boots, using your configuration found in /etc/cloudflared.

3. Manually start the service

Run the following command:

sudo launchctl start com.cloudflare.cloudflared

The output will be logged to /Library/Logs/com.cloudflare.cloudflared.err.log and /Library/Logs/com.cloudflare.cloudflared.out.log.

Next steps

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:

sudo launchctl stop com.cloudflare.cloudflared
sudo launchctl start com.cloudflare.cloudflared

Was this helpful?

YesNo

On this page

macOS (3) - 图1Docs

{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/tunnel/features/locally-managed-tunnels/as-a-service/macos/#page","headline":"macOS","description":"Install and run cloudflared as a launch agent on macOS.","url":"https://developers.cloudflare.com/tunnel/features/locally-managed-tunnels/as-a-service/macos/","inLanguage":"en","image":"https://developers.cloudflare.com/tunnel/features/locally-managed-tunnels/as-a-service/macos/og.png?v=c26f7b61a8d0ff73","dateModified":"2026-09-11","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"},"keywords":["MacOS"]}


description: Install and run cloudflared as a Windows service. title: Windows image: https://developers.cloudflare.com/tunnel/features/locally-managed-tunnels/as-a-service/windows/og.png?v=670a5f401668b36b


Skip to content

Documentation Index
Fetch the complete documentation index at: https://developers.cloudflare.com/tunnel/llms.txt
Use this file to discover all available pages before exploring further.