Back to Docs

CLI Reference

Tunnel client installation, manual tunnel setup, and advanced configuration.

Installing cloudflared

The MR Coder extension manages cloudflared automatically when creating tunnels. If you prefer manual control, or the extension prompts you to install it, follow the instructions for your operating system.

macOS

Bash
# Homebrew (recommended)
brew install cloudflared

# Or download the binary directly
curl -fsSL https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-darwin-amd64.tgz | \
  tar xz && sudo mv cloudflared /usr/local/bin/

For Apple Silicon (M1/M2/M3), Homebrew installs the correct arm64 binary automatically.

Windows

Bash
# Using winget (recommended, built into Windows 10/11)
winget install Cloudflare.cloudflared

# Using Chocolatey
choco install cloudflared

# Using Scoop
scoop install cloudflared

After installing, open a new terminal (PowerShell or Command Prompt) and run cloudflared --version to verify. If the command is not found, you may need to add the install location to your system PATH.

Tip:If you don't have winget, Chocolatey, or Scoop, download the .msi installer from the official downloads page.

Linux

Debian / Ubuntu

Bash
# Add the package signing key and repository
curl -fsSL https://pkg.cloudflare.com/cloudflare-main.gpg | \
  sudo tee /usr/share/keyrings/cloudflare-main.gpg > /dev/null

echo "deb [signed-by=/usr/share/keyrings/cloudflare-main.gpg] \
  https://pkg.cloudflare.com/cloudflared $(lsb_release -cs) main" | \
  sudo tee /etc/apt/sources.list.d/cloudflared.list

# Install
sudo apt update && sudo apt install -y cloudflared

RHEL / Fedora / CentOS

Bash
sudo rpm --import https://pkg.cloudflare.com/cloudflare-main.gpg
curl -fsSL https://pkg.cloudflare.com/cloudflared-ascii.repo | \
  sudo tee /etc/yum.repos.d/cloudflared.repo
sudo dnf install -y cloudflared

Arch Linux

Bash
yay -S cloudflared-bin

Generic (any distro)

Bash
# Download the latest binary
curl -fsSL https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64 \
  -o cloudflared
chmod +x cloudflared
sudo mv cloudflared /usr/local/bin/

Docker

Bash
docker pull cloudflare/cloudflared:latest
docker run cloudflare/cloudflared:latest --version
Verify your installation: Open a terminal and run cloudflared --version. You should see output like cloudflared version 2024.12.0 (built 2024-12-01). If the command is not found, ensure the binary is in your system PATH and restart your terminal.

Manual Tunnel Creation

If you need to create a tunnel outside of the extension or web dashboard:

Bash
# Authenticate the tunnel client
cloudflared tunnel login

# Create a named tunnel
cloudflared tunnel create my-workspace

# Route DNS
cloudflared tunnel route dns my-workspace my-workspace.mr-coder.io

# Run with ingress rules
cloudflared tunnel --config config.yml run my-workspace

Configuration File

A typical config.yml for multi-port tunneling:

YAML
tunnel: <TUNNEL_UUID>
credentials-file: ~/.cloudflared/<TUNNEL_UUID>.json

ingress:
  # VS Code Web IDE
  - hostname: my-workspace.mr-coder.io
    service: http://localhost:18462

  # API server (path-based routing)
  - hostname: my-workspace.mr-coder.io
    path: /api/*
    service: http://localhost:8080

  # Database UI
  - hostname: my-workspace.mr-coder.io
    path: /db/*
    service: http://localhost:8081

  # Catch-all (required)
  - service: http_status:404

Useful Commands

CommandDescription
cloudflared --versionCheck installed version
cloudflared tunnel listList all tunnels
cloudflared tunnel info <name>Show tunnel details
cloudflared tunnel run <name>Start a tunnel
cloudflared tunnel delete <name>Delete a tunnel
cloudflared tunnel cleanup <uuid>Remove stale connections
cloudflared updateUpdate to latest version

Troubleshooting

"cloudflared: command not found"

The binary is not in your system PATH. On Windows, try opening a new terminal after installation. On macOS/Linux, ensure /usr/local/bin is in your PATH. You can also run which cloudflared (macOS/Linux) or where cloudflared (Windows) to check.

Tunnel not connecting

Check that cloudflared is installed and authenticated. Run cloudflared tunnel listto verify your tunnels exist. Ensure no firewall is blocking outbound connections on port 7844 (cloudflared's default QUIC port).

DNS not resolving

CNAME propagation can take up to 60 seconds. Check with dig my-workspace.mr-coder.io or nslookup my-workspace.mr-coder.io. If the record doesn't appear after 2 minutes, verify the route was created with cloudflared tunnel route dns <tunnel-name> <hostname>.

Port conflict

Ensure the target port is not already bound by another process. On macOS/Linux: lsof -i :<port>. On Windows: netstat -ano | findstr :<port>.

Permission denied (Linux)

If running as a non-root user, ensure the cloudflared binary has execute permissions: chmod +x /usr/local/bin/cloudflared. The credentials file at ~/.cloudflared/ must be readable by your user.