azure-cli: unable to update cli using homebrew
I tried to install the latest CLI from the docs: https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-macos?view=azure-cli-latest. 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
Password:
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
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 17 (3 by maintainers)
I ran
brew reinstall python3
to fix thisI 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!
brew reinstall python3 fixed it for me, too.
It looks like I had originally installed the az CLI using the install script (https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-linux?view=azure-cli-latest). I cleaned that up using the instructions provided with that page, then installed using homebrew and it works. Generally. When I run
az --version
I get this:So, the same error for --version, but everything else seems to work.
You could also try
brew doctor
and see if that provides any hints.