Install Azure CLI 2.0 on macOS

For the macOS platform, you can install the Azure CLI with homebrew package manager. Homebrew makes it easy to keep your installation of the CLI update to date. The CLI package has been tested on macOS versions 10.9 and later.

Install

Homebrew is the easiest way to manage your CLI install. It provides convenient ways to install, update, and uninstall. If you don't have homebrew available on your system, install homebrew before continuing.

You can install the CLI by updating your brew repository information, and then running the install command:

brew update && brew install azure-cli

You can then run the Azure CLI with the az command. To log in, run the az login command.

az login

To learn more about different login methods, see Log in with Azure CLI 2.0.

Troubleshooting

If you encounter a problem when installing the CLI through Homebrew, here are some common errors. If your issue is not listed here, please file an issue on github.

Unable to find Python or installed packages

If your install is unable to find Python or installed packages, there may be a minor version mismatch or other issue that occurred during homebrew installation. Since the CLI does not use a Python virtual environment, it relies on being able to find correct Python version. You may be able to fix these issues by relinking your Python installation.

brew link --overwrite python3

CLI version 1.x is installed

If an out-of-date version was installed, it could be due to a stale homebrew cache. Follow the update instructions.

Update

The CLI is regularly updated with bug fixes, improvements, new features, and preview functionality. A new release is available roughly every two weeks. Update your local repository information and then upgrade the azure-cli package.

brew update && brew upgrade azure-cli

Uninstall

If you decide to uninstall the Azure CLI, we're sorry to see you go. Before you uninstall, use the az feedback command to give some information about why you chose to uninstall and how the CLI could be improved. Our goal is to make the Azure CLI bug-free and user-friendly. If you encountered a bug, we'd appreciate it if you file a GitHub issue.

Use homebrew to uninstall the azure-cli package.

brew uninstall azure-cli