Install the Dapr CLI

Install the Dapr CLI as the main tool for running Dapr-related tasks

You’ll use the Dapr CLI as the main tool for various Dapr-related tasks. You can use it to:

  • Run an application with a Dapr sidecar.
  • Review sidecar logs.
  • List running services.
  • Run the Dapr dashboard.

The Dapr CLI works with both self-hosted and Kubernetes environments.

Step 1: Install the Dapr CLI

Install from Terminal

Install the latest Linux Dapr CLI to /usr/local/bin:

  1. wget -q https://raw.githubusercontent.com/dapr/cli/master/install/install.sh -O - | /bin/bash

Install without sudo

If you do not have access to the sudo command or your username is not in the sudoers file, you can install Dapr to an alternate directory via the DAPR_INSTALL_DIR environment variable. This directory must already exist and be accessible by the current user.

  1. wget -q https://raw.githubusercontent.com/dapr/cli/master/install/install.sh -O - | DAPR_INSTALL_DIR="$HOME/dapr" /bin/bash

Install from Command Prompt

Install the latest windows Dapr cli to C:\dapr and add this directory to the User PATH environment variable:

  1. powershell -Command "iwr -useb https://raw.githubusercontent.com/dapr/cli/master/install/install.ps1 | iex"

Install without administrative rights

If you do not have admin rights, you can install Dapr to an alternate directory via the DAPR_INSTALL_DIR environment variable.

  1. $script=iwr -useb https://raw.githubusercontent.com/dapr/cli/master/install/install.ps1; $block=[ScriptBlock]::Create($script); invoke-command -ScriptBlock $block -ArgumentList "", "$HOME/dapr"

Install from Terminal

Install the latest Darwin Dapr CLI to /usr/local/bin:

  1. curl -fsSL https://raw.githubusercontent.com/dapr/cli/master/install/install.sh | /bin/bash

For ARM64 Macs:

ARM64 Macs support is available as a preview feature. When installing from the terminal, native ARM64 binaries are downloaded once available. For older releases, AMD64 binaries are downloaded and must be run with Rosetta2 emulation enabled.

To install Rosetta emulation:

  1. softwareupdate --install-rosetta

Install from Homebrew

Install via Homebrew:

  1. brew install dapr/tap/dapr-cli

For ARM64 Macs:

For ARM64 Macs, only Homebrew 3.0 and higher versions are supported. Please update Homebrew to 3.0.0 or higher and then run the command below:

  1. arch -arm64 brew install dapr/tap/dapr-cli

Install without sudo

If you do not have access to the sudo command or your username is not in the sudoers file, you can install Dapr to an alternate directory via the DAPR_INSTALL_DIR environment variable. This directory must already exist and be accessible by the current user.

  1. curl -fsSL https://raw.githubusercontent.com/dapr/cli/master/install/install.sh | DAPR_INSTALL_DIR="$HOME/dapr" /bin/bash

Each release of Dapr CLI includes various OSes and architectures. You can manually download and install these binary versions.

  1. Download the desired Dapr CLI from the latest Dapr Release.
  2. Unpack it (e.g. dapr_linux_amd64.tar.gz, dapr_windows_amd64.zip).
  3. Move it to your desired location.
    • For Linux/MacOS, we recommend /usr/local/bin.
    • For Windows, create a directory and add this to your System PATH. For example:
      • Create a directory called C:\dapr.
      • Add your newly created directory to your User PATH, by editing your system environment variable.

Step 2: Verify the installation

Verify the CLI is installed by restarting your terminal/command prompt and running the following:

  1. dapr

Output:

  1. __
  2. ____/ /___ _____ _____
  3. / __ / __ '/ __ \/ ___/
  4. / /_/ / /_/ / /_/ / /
  5. \__,_/\__,_/ .___/_/
  6. /_/
  7. ===============================
  8. Distributed Application Runtime
  9. Usage:
  10. dapr [command]
  11. Available Commands:
  12. completion Generates shell completion scripts
  13. components List all Dapr components. Supported platforms: Kubernetes
  14. configurations List all Dapr configurations. Supported platforms: Kubernetes
  15. dashboard Start Dapr dashboard. Supported platforms: Kubernetes and self-hosted
  16. help Help about any command
  17. init Install Dapr on supported hosting platforms. Supported platforms: Kubernetes and self-hosted
  18. invoke Invoke a method on a given Dapr application. Supported platforms: Self-hosted
  19. list List all Dapr instances. Supported platforms: Kubernetes and self-hosted
  20. logs Get Dapr sidecar logs for an application. Supported platforms: Kubernetes
  21. mtls Check if mTLS is enabled. Supported platforms: Kubernetes
  22. publish Publish a pub-sub event. Supported platforms: Self-hosted
  23. run Run Dapr and (optionally) your application side by side. Supported platforms: Self-hosted
  24. status Show the health status of Dapr services. Supported platforms: Kubernetes
  25. stop Stop Dapr instances and their associated apps. . Supported platforms: Self-hosted
  26. uninstall Uninstall Dapr runtime. Supported platforms: Kubernetes and self-hosted
  27. upgrade Upgrades a Dapr control plane installation in a cluster. Supported platforms: Kubernetes
  28. Flags:
  29. -h, --help help for dapr
  30. -v, --version version for dapr
  31. Use "dapr [command] --help" for more information about a command.

Next step: Initialize Dapr >>

Last modified June 23, 2022: Merge pull request #2550 from ItalyPaleAle/cosmosdb-harcoded-dapr-version (cf03237)