The `cloudflared update` command is used to check for and install the latest stable version of the `cloudflared` daemon. It ensures that your `cloudflared` installation is up-to-date, providing access to the newest features, bug fixes, and security enhancements.
cloudflared update [flags]When executed, `cloudflared update` first checks for the availability of a newer stable version of the `cloudflared` binary. If an update is found, it will download and replace the currently running `cloudflared` executable with the newer version. Depending on your operating system and permissions, you might need to run this command with elevated privileges (e.g., `sudo` on Linux/macOS or as an Administrator on Windows) if `cloudflared` is installed in a system-wide path.
After a successful update, it's often necessary to restart any active `cloudflared` services or tunnels for the changes to take effect. The command typically provides feedback on the current version, the latest available version, and the success or failure of the update.
* `--check`: Only check for updates; do not actually perform the update. This is useful for scripting or monitoring to see if an update is available without disrupting the current service.
* `--version <VERSION>`: Update to a specific version of `cloudflared` instead of the latest stable version. This is useful for rolling back to a previous version or testing a specific release.
* `--file <PATH_TO_BINARY>`: Update from a local `cloudflared` binary file instead of downloading it from Cloudflare's servers. This is useful for offline updates or custom builds.
* `--output <DIRECTORY>`: Specify the directory where the updated `cloudflared` binary should be saved. By default, it replaces the existing binary.
* `--force`: Force the update even if the current version is already the latest. This can be useful for reinstalling a potentially corrupted binary.
* `--accept-license`: Automatically accept the license agreement without prompting. Useful for non-interactive scripts.
* `--darwin-allow-unsigned`: (macOS specific) Allow running an unsigned `cloudflared` binary. Use with caution.
**1. Update to the latest stable version:**
This is the most common use case. Run this command to get the newest features and bug fixes.
cloudflared updateIf `cloudflared` is installed in a system directory (e.g., `/usr/local/bin`), you might need to use `sudo`:
sudo cloudflared update**2. Check for updates without installing:**
Use the `--check` flag to see if a newer version is available without performing the actual update. This will output a message indicating if an update is available.
cloudflared update --check**3. Update to a specific version:**
If you need to roll back to a previous version or target a specific release (e.g., `2023.10.0`), use the `--version` flag.
cloudflared update --version 2023.10.0**4. Update from a local binary file:**
If you have manually downloaded a `cloudflared` binary, you can use the `--file` flag to update from it. This is useful in environments with restricted internet access or for testing custom builds.
cloudflared update --file /path/to/my/cloudflared_new_version**5. Update in a non-interactive script (accepting license automatically):**
When running updates as part of an automated script, you might want to automatically accept any license prompts.
sudo cloudflared update --accept-license* **Permissions**: Ensure `cloudflared` has the necessary write permissions to its installation directory to perform the update. Otherwise, you'll likely need to use `sudo` or run as an administrator.
* **Restart Services**: After updating, it is crucial to restart any running `cloudflared` tunnels or services (e.g., `systemd` services, Docker containers) to ensure they pick up the new binary. The update command typically replaces the executable, but running processes continue using the old binary until restarted.
* **Rollback**: While `--version` allows you to downgrade, it's good practice to back up your existing `cloudflared` binary before a major update, especially in production environments, to facilitate easy rollback if issues arise.
* **Connectivity**: The `update` command requires internet connectivity to Cloudflare's update servers unless you are using the `--file` flag.