Solvedazure cli unable to update cli using homebrew

I tried to install the latest CLI from the docs: I'm pretty sure I installed using brew so I ran:

brew update && brew install azure-cli

it ran for a while, then this:

Error: An unexpected error occurred during the `brew link` step
The formula built, but is not symlinked into /usr/local
Permission denied @ dir_s_mkdir - /usr/local/Frameworks
Error: Permission denied @ dir_s_mkdir - /usr/local/Frameworks

Tried to do this manually:

~/src/vscode-docker$ brew link --overwrite python3
Linking /usr/local/Cellar/python3/3.6.4_2... Error: Permission denied @ dir_s_mkdir - /usr/local/Frameworks

So I tried running with sudo and get a big error:

~/src/vscode-docker$ sudo brew link --overwrite python3
Error: Running Homebrew as root is extremely dangerous and no longer supported.
As Homebrew does not drop privileges on installation you would be giving all
build scripts full access to your system.

If i run brew upgrade azure-cli i see:

Error: azure-cli 2.0.26 already installed

if i which az gives me /usr/local/bin/az

18 Answers

✔️Accepted Answer

I ran
brew reinstall python3
to fix this

Other Answers:

I solve my case, hope solve yours:

1.- Uninstall Azure CLI (could have an error, it is ok)
brew uninstall azure-cli

2.- Update just brew
brew update

3.- Upgrade brew
brew upgrade

4.- Clean up brew
brew cleanup

5.- Reinstall just the Azure CLI
brew install azure-cli

6.- Check the CLI
az help

Hope it works for you!

More Issues: